Jump to content

Recommended Posts

Posted

Im trying to write a script that will create a folder where the name of the folder is dd-MM-yy

I have created a gui with a date picker

and created a function that formats the date correctly

my question is even though the date picker is called $dateBox and the formatting is applied to $date

when i click the run button the date in the date picker changes from long format like 8th August 2007 to 08-08-07

i want to keep displaying long format in the date picker ($dateBox) & have the formatting only applied to $date

(i think that makes sence)

Can anyone help me here ?

Posted

Its a bit scratchy at the moment but there you go

CODE
#include <GUIConstants.au3>

GUICreate("Test GUI")

$datebox=GUICtrlCreateDate ("", 10,40,185,20 )

$Button_1 = GUICtrlCreateButton ("Copy", 10, 70, 100)

GUISetState()

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_1

$date=Format_date($datebox)

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

EndSelect

Wend

Func Format_date ($date)

; to select a specific default format

$DTM_SETFORMAT = 0x1032

$style = "dd-MM-yy"

GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style)

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

Return $date

EndFunc

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
  • Recently Browsing   0 members

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