goodmanjl531 Posted January 16, 2022 Share Posted January 16, 2022 I need to print out dates in a specfic format YYYY-MM-DD I can get it to work for the first time but since i am using _dateAdd function it converts my date to YYYY/MM/DD Any ideas on what im missing to convert it to the - instead of the / when outputting the data? $Date_FY_YearStart = GUICtrlCreateDate("2022-01-01", 23, 96, 134, 105) Local $sStyle = "yyyy-mm-dd" GUICtrlSendMsg($Date_FY_YearStart, $DTM_SETFORMATW, 0, $sStyle) $currentFYWeekDate = $FYStart $currentFYweekDTEnd = _DateAdd('D', 6, $FYStart) Send("<start dtype=" & "{ASC 34}" & "Date" & "{ASC 34}" & ">" & $currentFYWeekDate & "</start>"& @CR) Thanks in advance for any help. Link to comment Share on other sites More sharing options...
Solution Nine Posted January 16, 2022 Solution Share Posted January 16, 2022 Maybe this : #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <Date.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("2022/01/01", 10, 10, 185, 20) ; to select a specific default format Local $sStyle = "yyyy-MM-dd" GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Selected", GUICtrlRead($idDate)) Local $currentFYWeekDate = StringReplace(GUICtrlRead($idDate), "-", "/") Local $currentFYweekDTEnd = _DateAdd('D', 6, $currentFYWeekDate) ConsoleWrite(StringReplace($currentFYweekDTEnd, "/", "-") & @CRLF) EndFunc ;==>Example “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
goodmanjl531 Posted January 16, 2022 Author Share Posted January 16, 2022 (edited) Forgot about stringreplace function it worked perfectly i just added that to my output stream. Send("<start dtype=" & "{ASC 34}" & "Date" & "{ASC 34}" & ">" & StringReplace($currentFYWeekDate,"/","-") & "</start>"& @CR) Send("<end dtype=" & "{ASC 34}" & "Date" & "{ASC 34}" & ">" & StringReplace($currentFYweekDTEnd,"/","-") & "</end>"& @CR) Thanks for the help 🙂 Edited January 16, 2022 by goodmanjl531 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