avechuche Posted August 18, 2014 Share Posted August 18, 2014 (edited) hi!, First, I searched the forum but not found the solution to my problem. The problem is I can not change the day. This is a piece of my code. $hdate = GUICtrlCreateDate("", 125, $iTop - 50, 150, -1, $DTS_SHORTDATEFORMAT) $hWndDate = ControlGetHandle($hGui, "", $hdate) _GUICtrlDTP_SetFormat($hWndDate, "dd/MM/yyyy - HH:mm:ss") If ($sTipo == "Editar") Then GUICtrlSetState($hdate, 128) GUICtrlSetData($hdate, $aDatosParaModificar[5]) GUICtrlSetData($hWndDate, $aDatosParaModificar[5]) EndIf $aDatosParaModificar[5] is a string with format "dd/MM/yyyy - HH:mm:ss" (Ej: 30/12/ 2000 - 22:10:35) Edited August 18, 2014 by avechuche Link to comment Share on other sites More sharing options...
kylomas Posted August 20, 2014 Share Posted August 20, 2014 avechuche, You will get better response to queries if you post runnable code. I wrapped your code to make it runnable and included comments where appropriate. ; *** Start added by AutoIt3Wrapper *** #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> ; *** End added by AutoIt3Wrapper *** #include <GuiDateTimePicker.au3> #AutoIt3Wrapper_Add_Constants=n local $hGUI = guicreate('Date Control Format Test') local $itop = 100, $sTipo = 'Editar', $aDatosParaModificar[6] = ['','','','','',"'My new date format = ' MM/dd/yyyy - HH:mm:ss"] $hdate = GUICtrlCreateDate("", 125, $iTop - 50, 250, -1, $DTS_SHORTDATEFORMAT) $hWndDate = ControlGetHandle($hGui, "", $hdate) _GUICtrlDTP_SetFormat($hWndDate, "dd/MM/yyyy - HH:mm:ss") guisetstate() If ($sTipo == "Editar") Then ;GUICtrlSetState($hdate, 128) don't disable the control _guictrldtp_setformat($hWndDate, $aDatosParaModificar[5]) ;GUICtrlSetData($hWndDate, $aDatosParaModificar[5]) date formats cannot be changed with guictrlsetdata, only the date value EndIf while 1 switch guigetmsg() case $gui_event_close Exit EndSwitch WEnd kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
avechuche Posted August 21, 2014 Author Share Posted August 21, 2014 Oooooo perfect!!!!! THX!!!!! 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