mdes Posted April 28, 2005 Posted April 28, 2005 (edited) I would like to GUICtrlCreateDate() by displaying the System Long format, BUT GUICtrlRead() in the format yyyy/mm/dd. So, another way to say: How to convert a system long date format to a format for calculation ?ps: This should work with "any" locale setting (USA, France,...) Edited April 28, 2005 by mdes Gestion des congés, RTT, vacances scolaires, autres absences sur Pocket PC : CongésRFV
zeroZshadow Posted April 28, 2005 Posted April 28, 2005 thought of the macro's yet?? maby i'm wrong bu this should be easy, do you have a example script of ur problem?? *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
mdes Posted April 28, 2005 Author Posted April 28, 2005 (edited) maby i'm wrong bu this should be easy, do you have a example script of ur problem??Not so easy, because I don't know the foreign formats:Saterday, April 14, 2005 ?Saterday, 14 April 2005 ?Samedi 14 avril 2005...I said: "any" locale setting (and not for the current date, but for any date) Edited April 28, 2005 by mdes Gestion des congés, RTT, vacances scolaires, autres absences sur Pocket PC : CongésRFV
zeroZshadow Posted April 28, 2005 Posted April 28, 2005 Macro Description @SEC Seconds value of clock. Range is 00 to 59 @MIN Minutes value of clock. Range is 00 to 59 @HOUR Hours value of clock in 24-hour format. Range is 00 to 23 @MDAY Current day of month. Range is 01 to 31 @MON Current month. Range is 01 to 12 @YEAR Current four-digit year @WDAY Numeric day of week. Range is 1 to 7 which corresponds to Sunday through Saturday. @YDAY Current day of year. Range is 1 to 366 (or 365 if not a leap year) this u mean?? p.s. EXAMPLE SCRIPT *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
randallc Posted April 28, 2005 Posted April 28, 2005 hi,does this help?Dates ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
mdes Posted April 28, 2005 Author Posted April 28, 2005 I restart stating my problem. Here is a sample script:#include <GUIConstants.au3> GUICreate ( "My GUI get date", 200,200,800,200) $date=GUICtrlCreateDate ("2005/01/01", 10,10,185,20 ) GUISetState () Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE $DispDate = GUICtrlRead($date) $NewDate = "" ;==== What to insert here to transform $DispDate in the yyyymmdd format ? ==== MsgBox(0,"Date", "$DispDate=" & $DispDate & @CR & "$NewDate=" & $NewDate) GUIDelete()When running this script, the following GUI is displayed (I want this date format displayed):And after exiting, the following message box is displayed:I would like $NewDate to be assigned the value 2005/01/01 (if the user does not change the date).That's all Folks!@randallc: @YEAR,... return the current date. What I would like to have is any date in the YYYYMMDD format (or with embedded "/", or "-"). Gestion des congés, RTT, vacances scolaires, autres absences sur Pocket PC : CongésRFV
jpm Posted April 28, 2005 Posted April 28, 2005 I restart stating my problem. Here is a sample script:#include <GUIConstants.au3> GUICreate ( "My GUI get date", 200,200,800,200) $date=GUICtrlCreateDate ("2005/01/01", 10,10,185,20 ) GUISetState () Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE $DispDate = GUICtrlRead($date) $NewDate = "";==== What to insert here to transform $DispDate in the yyyymmdd format ? ==== MsgBox(0,"Date", "$DispDate=" & $DispDate & @CR & "$NewDate=" & $NewDate) GUIDelete()When running this script, the following GUI is displayed (I want this date format displayed):And after exiting, the following message box is displayed:I would like $NewDate to be assigned the value 2005/01/01 (if the user does not change the date).That's all Folks!@randallc: @YEAR,... return the current date. What I would like to have is any date in the YYYYMMDD format (or with embedded "/", or "-").<{POST_SNAPBACK}>see example3 in the doc
mdes Posted April 28, 2005 Author Posted April 28, 2005 see example3 in the doc Thanks for your quick reply, but - as I said - I would like to keep the default format displayed "day d mmmm yyyy".The problem is "How to display a format, but getting back another one?" Gestion des congés, RTT, vacances scolaires, autres absences sur Pocket PC : CongésRFV
jpm Posted April 29, 2005 Posted April 29, 2005 Thanks for your quick reply, but - as I said - I would like to keep the default format displayed "day d mmmm yyyy".The problem is "How to display a format, but getting back another one?"<{POST_SNAPBACK}>I understand, you need a _datetimeformat working the other way around. Perhaps somebody can write an UDF for that. Remember AutoiT is a wrapper above Windows API somebody can find a solution to this conversion problem and I will be glad to see if we can incorparte it inside AutoIt.
randallc Posted April 29, 2005 Posted April 29, 2005 (edited) I understand, you need a _datetimeformat working the other way around. Perhaps somebody can write an UDF for that. Remember AutoiT is a wrapper above Windows API somebody can find a solution to this conversion problem and I will be glad to see if we can incorparte it inside AutoIt. <{POST_SNAPBACK}>i think you just want to reset the format to leave it the same?#include <GUIConstants.au3>GUICreate ( "My GUI get date", 200,200,800,200)$date=GUICtrlCreateDate ("2005/01/01", 10,10,185,20 )$Button_OK1 =GUICtrlCreateButton ("&OK",32, 32, 40)GUISetState ()while 1 $msg = GUIGetMsg() if $msg =$Button_OK1 Then displayDate() endif if $msg =$GUI_EVENT_CLOSE Then ExitLoop endif WEnd Exitfunc displayDate()$DispDate = GUICtrlRead($date)$DTM_SETFORMAT = 0x1005$style = "yyyy/MM/dd"GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style)$NewDate = GUICtrlRead($date); reset format$DTM_SETFORMAT = 0x1005$style = "dddd, d MMMM yyyy"GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style)MsgBox(0,"Date", "$DispDate=" & $DispDate & @CR & "$NewDate=" & $NewDate)EndFunc OK?Randall Edited April 29, 2005 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
mdes Posted April 29, 2005 Author Posted April 29, 2005 i think you just want to reset the format to leave it the same? OK?RandallThanks a lot, Randall, that's exactly what I wanted somebody can find a solution to this conversion problem and I will be glad to see if we can incorparte it inside AutoIt. Thanks also to jpm for its proposal but Randall found it Gestion des congés, RTT, vacances scolaires, autres absences sur Pocket PC : CongésRFV
jpm Posted April 29, 2005 Posted April 29, 2005 Thanks Randall, that's the power of a forum. Somebody has the answer...
Kerberuz Posted April 29, 2005 Posted April 29, 2005 i think you just want to reset the format to leave it the same? OK?Randall<{POST_SNAPBACK}>I added one more modification to your Code Randall. It adds the ability to read from the registry the international Long and Short Date.#include <GUIConstants.au3> GUICreate ( "My GUI get date", 200,200,800,200) $date=GUICtrlCreateDate ("2005/01/01", 10,10,185,20 ) $Button_OK1 =GUICtrlCreateButton ("&OK",32, 32, 40) GUISetState () while 1 $msg = GUIGetMsg() if $msg =$Button_OK1 Then displayDate() endif if $msg =$GUI_EVENT_CLOSE Then ExitLoop endif WEnd Exit func displayDate() $DispDate = GUICtrlRead($date) $DTM_SETFORMAT = 0x1005 $style = RegRead( "HKEY_CURRENT_USER\Control Panel\International" , "sShortDate") GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style) $NewDate = GUICtrlRead($date) ; reset format $DTM_SETFORMAT = 0x1005 $style = RegRead( "HKEY_CURRENT_USER\Control Panel\International" , "sLongDate") GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style) MsgBox(0,"Date", "$DispDate=" & $DispDate & @CR & "$NewDate=" & $NewDate) EndFunc Kerby
mdes Posted April 29, 2005 Author Posted April 29, 2005 (edited) I added one more modification to your Code Randall. It adds the ability to read from the registry the international Long and Short Date.$style = RegRead( "HKEY_CURRENT_USER\Control Panel\International" , "sShortDate")I don't agree: "sShortDate" will give "dd/MM/yyyy" or "MM/dd/yyyy" depending on the country; so my application would not be able to process directly the date without analyzing this "sShortDate" But I fully agree to read the Registry for "sLongDate", and in any other case Edited April 29, 2005 by mdes Gestion des congés, RTT, vacances scolaires, autres absences sur Pocket PC : CongésRFV
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