Jump to content

Date_Time_Convert - New version 17 Jun 23


Melba23
 Share

Recommended Posts

  • Melba23 changed the title to Date_Time_Convert - New version 17 Jun 23
  • Moderators

New version - 17 Jun 23
=======================

Added: Added 24hr unpadded H mask.

New UDF in first post.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 1 month later...
  • Moderators

gcue,

Well spotted. Try this: 

M23

Edited by Melba23
Beta code removed

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

fixed 

$first_date = "2022-02"
$first_date = _Date_Time_Convert($first_date, "yyyy-MM", "MM/yyyy")

but now the first 2 here are broken again

;~ $string = "4/28/2023 3:19"
;~ $string = "4/28/2023 9:51"
;~ $string = "4/28/2023 10:51"
;~ $string = "4/28/2023 14:51"

$new_string = _Date_Time_Convert($string, "M/d/yyyy HH:mm", "yyyyMMddHHmm")
ConsoleWrite($new_string & @CRLF)

sorry to be the bearer of bad news 

Link to comment
Share on other sites

  • Moderators

gcue,

Mierda! Looking into it!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

lol.

hmm not sure if you are doing this but might be good to collect several samples of formats to convert to "yyyyMMddHHmm" for instance - to automate the testing to ensure output is in that format

then maybe other formats to convert to as well and test for those output formats, etc etc

so anytime you make a change just run it through the automated test script.

not sure if that makes sense

just a thought 😊

Link to comment
Share on other sites

  • Moderators

gcue,

<sarcasm>

Nah, it is much more fun just to release buggy code!

</sarcasm>

That is just what I do - but there is a limit to how many formats I can test.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

gcue,

Quote

but now the first 2 here are broken again

As I already told you in an earlier post, you need to use the new "H" format if you are using an unpadded 24hr format. In the snippet you posted above you are still using "HH". When I change the format all works as it should.

So I am writing this off as "no bug",

M23

Edited by Melba23
Added a line

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

gcue,

Quote

 i thought it supported both H and HH

It does. But when you have unpadded 24hr codes in the input (which is the case in your example) you must tell the UDF that is the case by using "H". Using "HH" tells it to expect a 2-digit hour value, which is why it errors on the first 2 examples.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 3 weeks later...
On 7/22/2023 at 9:47 AM, Melba23 said:

gcue,

Well spotted. Try this:

M23

@Melba23  Melba, This test UDF does not match the UDF in the top post which is dated 2/5/23. The top post says it was updated 17/6/23.

Also, it would be useful if the UDF were to contain a version number and or release date in the comment.

Edited by Melba23
Beta code in quote removed

Phil Seakins

Link to comment
Share on other sites

  • Moderators

pseakins,

Quote

This test UDF does not match the UDF in the top post

As one is beta code and the other is the last formal release, I would be rather worried if they did!

I will release a new version when I find time. 

M23 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Am I mistaken in thinking that this works as a date converter without time?

Global $sDate = 'August 11, 2023'
Global $sNewDate = _Date_Time_Convert($sDate, 'MMMM d, yyyy', 'yyyy-MM-dd')
If @error Then
    ConsoleWrite('@error = ' & @error & '; @extended = ' & @extended & @CRLF)
Else
    ConsoleWrite(StringFormat('%s = %s', $sDate, $sNewDate) & @CRLF)
EndIf
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
@error = 1; @extended = 8
+>09:15:19 AutoIt3.exe ended.rc:0
+>09:15:19 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 1.26

 

Link to comment
Share on other sites

  • Moderators

GMK,

No, it should do that. I will look into why it does not. Just as well I did not release this version, isn't it!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

19 hours ago, GMK said:

Am I mistaken in thinking that this works as a date converter without time?

GMK's code works on my W7 'puter with DTC_Test.au3 . However, a script I am developing does not work, will post code shortly.

>Running:(3.3.16.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\user\Documents\AutoIt\DTC_Example.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
August 11, 2023 = 2023-08-11
 

Phil Seakins

Link to comment
Share on other sites

On 8/12/2023 at 3:38 AM, Melba23 said:

GMK,

No, it should do that. I will look into why it does not. Just as well I did not release this version, isn't it!

; GMK's code works for me
$sDate = 'August 11, 2023'
$sNewDate = _Date_Time_Convert($sDate, 'MMMM d, yyyy', 'yyyy-MM-dd')
If @error Then
  ConsoleWrite('@error = ' & @error & '; @extended = ' & @extended & @CRLF)
Else
  ConsoleWrite(StringFormat('%s = %s', $sDate, $sNewDate) & @CRLF)
EndIf

; My code does not work
$sDate = 'July 9, 2023 8:00 AM'
$sNewDate = _Date_Time_Convert($sDate, "MMMM d, yyyy h:mm TT", "yyyy/MM/dd HH:mm:ss")
If @error Then
  ConsoleWrite('@error = ' & @error & '; @extended = ' & @extended & @CRLF)
Else
  ConsoleWrite(StringFormat('%s = %s', $sDate, $sNewDate) & @CRLF)
EndIf

; Distribution UDF
@error = 1; @extended = 8
July 9, 2023 8:00 AM = 2023/07/09 :00:**

; Melba's DTC_test.au3 as DTC.au3
August 11, 2023 = 2023-08-11
July 9, 2023 8:00 AM = 2023/07/09 :00:**

Actually the mask in my example does not need the seconds, so it should be more like "yyyy/MM/dd HH:mm" but even so I get the wrong result in the time field;-

July 9, 2023 8:00 AM = 2023/07/09 :00

Edited by pseakins
Added more information.

Phil Seakins

Link to comment
Share on other sites

On 8/11/2023 at 12:38 PM, Melba23 said:

GMK,

No, it should do that. I will look into why it does not. Just as well I did not release this version, isn't it!

M23

OK, I may have found the problem.  For If statements like the following:

If $aDTC_Data[7][1] & $aDTC_Data[7][2] = "" Then                ; Check AM/PM set

I replaced the '&' with 'And'

If $aDTC_Data[7][1] And $aDTC_Data[7][2] = "" Then              ; Check AM/PM set

which seemed to fix the problem.

Edited by GMK
Multiple replacements
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...