Sign in to follow this  
Followers 0
Lord Maim

$DTS_TIMEFORMAT in 24-Hour time?

3 posts in this topic

#1 ·  Posted (edited)

I'm using GUICtrlCreateDate to create a time box, but I'd like the time to display (and the user to interact with it) in 24 hour time. I'm pretty sure it has to do with using the style $DTS_TIMEFORMAT, but I haven't been able to find the correct method to make the control use 24 hour time. Can anyone assist me?

Edited by Lord Maim

Share this post


Link to post
Share on other sites



This is straight from the help file:

#include <GUIConstants.au3>

GUICreate ( "My GUI get date", 200,200,800,200)
$date = GUICtrlCreateDate ("1953/04/25", 10,10,185,20 )

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "yyyy/MM/dd HH:mm:ss"; This sets the hours to 24 hour format.  Capitol HH's mean 24 hour format.
GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

MsgBox(0,"Time", GUICtrlRead($date))

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

This is straight from the help file:

#include <GUIConstants.au3>

GUICreate ( "My GUI get date", 200,200,800,200)
$date = GUICtrlCreateDate ("1953/04/25", 10,10,185,20 )

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "yyyy/MM/dd HH:mm:ss"; This sets the hours to 24 hour format.  Capitol HH's mean 24 hour format.
GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

MsgBox(0,"Time", GUICtrlRead($date))
Huh. Must be a newer version of the help file than I have then. The one bundled with my 3.2.0.1 SciTE bundle doesn't have that comment in it.

Thanks for the help though, even if it was laced with an RTFM implication. :lmao:

Bottom line is the question got answered, and that's all that matters. Thanks again. :ph34r:

Share this post


Link to post
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
Sign in to follow this  
Followers 0