judgedk Posted March 5, 2009 Share Posted March 5, 2009 Hi, I made this little example, when i run this it shows todays date in the gui box. When i try to do a msgbox with $YD is shows the correct date. But when i put $YD in this $date1 = GUICtrlCreateDate($YD, 10, 10, 80, 20) it wont work.. Thank You for any Comments . expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> #include <DateTimeConstants.au3> Local $DTM_SETFORMAT_, $style $YD = @YEAR&"/"&@MON&"/"&@MDAY-1 $LY = @YEAR-1&"/"&@MON&"/"&@MDAY MsgBox(0, "", $YD) $Form1 = GUICreate("Form1", 366, 235, 193, 115) $date1 = GUICtrlCreateDate($YD, 10, 10, 80, 20) $date2 = GUICtrlCreateDate($LY, 10, 50, 80, 20) $Button1 = GUICtrlCreateButton("Button1", 136, 192, 89, 33, 0) GUISetState(@SW_SHOW) $style = "dd.MM.yyyy" $DTM_SETFORMAT_ = 0x1032 GUICtrlSendMsg($date1, $DTM_SETFORMAT_, 0, $style) GUICtrlSendMsg($date2, $DTM_SETFORMAT_, 0, $style) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _ok() EndSwitch WEnd func _ok() $1 = GUICtrlRead($date1) MsgBox(0, "Time", $1) $2 = GUICtrlRead($date2) MsgBox(0, "Time", $2) EndFunc Link to comment Share on other sites More sharing options...
BrettF Posted March 5, 2009 Share Posted March 5, 2009 expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> #include <DateTimeConstants.au3> Local $DTM_SETFORMAT_, $style $DTM_SETFORMAT_ = 0x1032 $YD = @YEAR&"/"&@MON&"/0"&@MDAY-1 $LY = @YEAR-1&"/"&@MON&"/"&@MDAY MsgBox(0, "", $YD) MsgBox(0, "", $LY) $Form1 = GUICreate("Form1", 366, 235, 193, 115) $date1 = GUICtrlCreateDate($YD, 10, 10, 100, 20) $date2 = GUICtrlCreateDate($LY, 10, 50, 100, 20) $Button1 = GUICtrlCreateButton("Button1", 136, 192, 89, 33, 0) GUISetState(@SW_SHOW) $style = "dd/MM/yyyy" GUICtrlSendMsg($date1, $DTM_SETFORMAT_, 0, $style) GUICtrlSendMsg($date2, $DTM_SETFORMAT_, 0, $style) GUICtrlSetData ($date1, $YD) GUICtrlSetData ($date2, $LY) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _ok() EndSwitch WEnd func _ok() $1 = GUICtrlRead($date1) MsgBox(0, "Time", $1) $2 = GUICtrlRead($date2) MsgBox(0, "Time", $2) EndFunc Does that work? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
judgedk Posted March 5, 2009 Author Share Posted March 5, 2009 Yes, thank you. This works. I see u made this change $YD = @YEAR&"/"&@MON&"/0"&@MDAY-1 Does that have any effect on the date when it comes to the 11.12.13 and so on? I'm at work right now so i cant change this computers date, so i have to ask ... Link to comment Share on other sites More sharing options...
Inverted Posted March 5, 2009 Share Posted March 5, 2009 Lol, that day-1 is awesome ! But what if the current day is the 1st of the month ? Link to comment Share on other sites More sharing options...
BrettF Posted March 5, 2009 Share Posted March 5, 2009 Use the _Date functions. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
judgedk Posted March 5, 2009 Author Share Posted March 5, 2009 Use the _Date functions. Cheers, Brett Like This ? $d1 = _NowCalcDate() $1 = _DateAdd('d',-1,$d1) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now