Search the Community
Showing results for tags 'date format'.
-
In some systems the date is displayed in the Taskbar as 10-01-2018 And in some systems it is like, 1/10/2018 And in some it is, 10-Jan-2018 And in different formats. I wrote my code to convert 1/10/2018 to 10-01-2018 Func TodaysDate() $NewDate = _DateTimeFormat(_NowCalcDate(),1) $Array = StringSplit( $NewDate , ',' ) _ArrayDelete($Array, 0) _ArrayDelete($Array, 0) $Array1 = StringSplit($Array[0],' ') RemoveEmptyArrayLines($Array1) ;Will return the present day's date with format dd-mmm-yyyy ;$Date = StringStripWS($Array1[2]&"-"&StringLeft($Array1[1], 3)&"-"&$Array[1], $STR_STRIPALL) $Date = StringStripWS($Array1[2]&"-"&changeDateformat(StringLeft($Array1[1], 3))&"-"&$Array[1], $STR_STRIPALL) return $Date EndFunc Func RemoveEmptyArrayLines(ByRef $arrLines) $intCount = 1 While $intCount < UBound($arrLines) $arrLines[$intCount] = StringStripWS($arrLines[$intCount],$STR_STRIPLEADING + $STR_STRIPTRAILING) If StringLen($arrLines[$intCount])=0 Then _ArrayDelete($arrLines, $intCount) $intCount = $intCount - 1 EndIf $intCount = $intCount + 1 WEnd EndFunc ;To convert mmm to mm format Func changeDateformat($sText) Local $sMsg = StringStripWS($sText, $STR_STRIPALL) Switch $sMsg Case "Jan" $sMsg = "01" Case "Feb" $sMsg = "02" Case "Mar" $sMsg = "03" Case "Apr" $sMsg = "04" Case "May" $sMsg = "05" Case "Jun" $sMsg = "06" Case "Jul" $sMsg = "07" Case "Aug" $sMsg = "08" Case "Sep" $sMsg = "09" Case "Oct" $sMsg = "10" Case "Nov" $sMsg = "11" Case "Dec" $sMsg = "12" EndSwitch return $sMsg EndFunc But again it will work on machines only with 1/10/2018. Is there any direct function which will give only in the format 10-01-2018, whatever the system settings is.? I tried all the arguments for _DateTimeFormat, but showing machine dependent settings only. Google given these two links in AutoIT but these are also for specific formats only,like mine. Please suggest.
-
Dears, The below code is working(20170314) in my UAT system but the same not working (-1-1-1) on production system. Please note "_NowCalc()" returning correct date time on all machine/systems. What could be the issue? Please help. Func GetDateYYYYMMDD() Local $aMyDate, $aMyTime _DateTimeSplit(_DateTimeFormat(_NowCalc(), 1), $aMyDate, $aMyTime) Local $iLenDay = StringLen($aMyDate[1]) Local $iLenMon = StringLen($aMyDate[2]) if $iLenDay = 1 Then $aMyDate[1] = "0"&$aMyDate[1] EndIf if $iLenMon = 1 Then $aMyDate[2] = "0"&$aMyDate[2] EndIf Local $newDateFormat = $aMyDate[3] & $aMyDate[2] & $aMyDate[1] MsgBox($MB_SYSTEMMODAL, "", "New Date " & $newDateFormat ) Return $newDateFormat EndFunc
-
I don't know what this is called, but I am just looking to change the date format from this: Oct. 19, 2015To MM/DD/YYYY Is there a native way to do this in AutoIt?
-
I am currently working on a project in which I have to find timestamps in multiple formated patterns. The idea is to search time stamps in log files. If successful _GetDateInString() will returns a timestamp in YYYY/MM/DD hh:mm:ss Example: _GetDateInString("...Process Last Run 17 JUN at 05:15...", "DD Mon at hh:mm") will return 2014/06/17 05:15:00 Formats tested: - DDMonYY hh:mm:ss (matches dates like 30May14 03:59:59) - DD Mon YYYY hh:mm - Mon, DD YYYY hh:mm:ss - Mon, D YYYY hh:mm:ss - DD Mon at hh:mm - DMonYY hh:mm:ss - DMon hh:mm:ss - DD/MM/YYYY hh:mm - DD-MM-YYYY hh:mm - DDMMYYYY hh:mm - DD/MM hh:mm - MM.DD.YYYY hh:mm - YYYYDDMM hh:mm - YYYYMMDD - hh:mm - DD.MM hh:mm - D/M/YYYY hh:mm - D.M.YYYY hh:mm - M.D.YY h:mm:ss - M.D.YY hh:mm - M.D.YY hh:mm - M.D.YYYY h:mm:ss - M.D.YYYY h:mm:ss - M.D at h:mm:ss and many other formats... udf with examples: _GetDateInString 1.0.0.1.au3 GreenCan