Function Reference


_GUICtrlDTP_SetFormat

Sets the display based on a given format string

#include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetFormat ( $hWnd, $sFormat )

Parameters

$hWnd Handle to the control
$sFormat String that defines the desired format. Setting this to blank will reset the control to the default format string for the current style. You can use the following format strings:
    "d" - The one or two digit day
    "dd" - The two digit day. Single digit day values are preceded by a zero
    "ddd" - The three character weekday abbreviation
    "dddd" - The full weekday name
    "h" - The one or two digit hour in 12-hour format
    "hh" - The two digit hour in 12-hour format
    "H" - The one or two digit hour in 24-hour format
    "HH" - The two digit hour in 24 hour format
    "m" - The one or two digit minute
    "mm" - The two digit minute
    "M" - The one or two digit month number
    "MM" - The two digit month number
    "MMM" - The three-character month abbreviation
    "MMMM" - The full month name
    "t" - The one letter AM/PM abbreviation
    "tt" - The two letter AM/PM abbreviation
    "yy" - The last two digits of the year
    "yyyy" - The full year

Return Value

Success: True.
Failure: False.

Remarks

It is acceptable to include extra characters within the format string to produce a more rich display.
However, any nonformat characters must be enclosed within single quotes.
For example, the format string "'Today is:
    'hh':'m':'s ddddMMMdd', 'yyy" would produce output like "Today is: 04:22:31 Tuesday Mar 23, 1996".

Note: A DTP control tracks locale changes when it is using the default format string.
If you set a custom format string, it will not be updated in response to locale changes.

Example

#include <GUIConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Example()

Func Example()
        Local $hDTP

        ; Create GUI
        GUICreate("DateTimePick Set Format (v" & @AutoItVersion & ")", 400, 300)
        $hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))

        GUISetState(@SW_SHOW)

        ; Set the display format
        Local $iRet = _GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iRet = ' & $iRet & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>Example