Search the Community

Showing results for tags 'date'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Chat
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 32 results

  1. I have established how to get tomorrows date however I can't seem to figure out how to format the date into my required format of MM/DD/YYYY. I have this: $today=_DateToDayValue(@YEAR,@MON,@MDAY) Dim $Y, $M, $D $tomorrow=_DayValueToDate($today+1, $Y, $M, $D) The _DateToDayValue seems to have a fixed format. I've also tried a : $vardate = _DateAdd( 'd',1, _NowCalcDate()) with a "StringSplit" and/or StringFormat but the _NowCalcDate seems to also be fixed to a YYYY/MM/DD format. I'm sure I'm missing something simple but am at a loss. Any help would be MUCH appreciated
  2. To get the current time stamp, I got the below code. #include <Date.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #RequireAdmin ; Under Vista the Windows API "SetSystemTime" may be rejected due to system security $td = _Date_Time_GetSystemTime() $td = _Date_Time_SystemTimeToDateTimeStr($td) $td = StringReplace($td, " ", "_") $td = StringReplace($td, ":", "_") MsgBox(0,"",$td) But it is not giving the date or time of the timezone where the system is there. Please suggestt
  3. When I tried the below code, I am getting the date in mm-dd-yyyy format. But I require dd-mm-yyyy format. Can anyone suggest how to do that. Func TodaysDate() return StringReplace(_DateTimeFormat(_NowCalc(), 2), "/", "-") EndFunc Earlier I tried dd-mmm-yyyy format and it is working with below code. Func TodaysDate() $NewDate = _DateTimeFormat(_NowCalcDate(),1) $Array = StringSplit( $NewDate , ',' ) _ArrayDelete($Array, 0) _ArrayDelete($Array, 0) $Array1 = StringSplit($Array[0],' ') RemoveEmptyArrayLines($Array1) $Date = StringStripWS($Array1[2]&"-"&StringLeft($Array1[1], 3)&"-"&$Array[1], $STR_STRIPALL) return $Date EndFunc Which is unnecessarily complicated I feel., the approach Now I need format of dd-mm-yyyy. Can anyone suggest how to do this.
  4. Hi guys, I have some code; which doesn't quite work. $dateStop = "11302015" $tDate = _Date_Time_GetSystemTime() $currentdatestring = _Date_Time_SystemTimeToDateStr($tDate) If $currentdatestring >= $dateStop Then MsgBox(0, "Expired", "Script has expired.") Exit EndIf Basically, I want to essentially put an expiry date on the script. Where in the example above, it is 30th November 2015. Sometimes it works, sometimes it doesn't. I may have the string wrong, I may have the code all wrong. I thought about using the macro @mon @year etc but it gets quite conditional. i.e. if its 2015, but October, or if its 2015 and Dec, or if its March 2016 etc. But simplicity is great. Any help would be awesome.
  5. Test instructions are easy. 1. Run the following code in post #46 2. Click the advanced tab 3. Select a start date and an end date 4. Put a tick in the checkbox where it says 'Include Days Of The Week' 5. Click the Okay button You should get an array with a column of dates in your local format and a second column with day names in your language. It has a current range limit of just under 89 years but this range can appear anywhere between the years 1601 and 9999. The code is untidy and unfinished, but I would still like to know if it works outside the UK. No extra includes are needed. If it works in China, that would make me happy. Latest version in post #46 https://www.autoitscript.com/forum/topic/184849-please-test-this-in-your-language-region/?do=findComment&comment=1327947 #include <Array.au3> #include <GUIConstants.au3> #include <GuiEdit.au3> #include <Misc.au3> #include <GuiTab.au3> #include <Date.au3> #include <APILocaleConstants.au3> #include <WinAPILocale.au3> ;#include <ArrayWorkshop.au3> ; required functions are already included in this demo NewTable() Func NewTable(); ($hParent, $idListView, $hListView) ; [missing parent window] Local $sTitle = "New Table", _ $iStyle = BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), _ $iExStyle = BitOR($WS_EX_MDICHILD, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST), _ $iWidth = 250, _ $iHeight = 292 Local $hChild = GUICreate($sTitle, $iWidth, $iHeight, Default + 100, Default + 100); , $iStyle, $iExStyle, $hParent) Local $idTab = GUICtrlCreateTab(2, 2, $iWidth -2, $iHeight -32) GUICtrlCreateTabItem("Standard") GUICtrlCreateLabel("Table Dimensions", 14, 35, 120, 20) GUICtrlSetColor(-1, 0x008000) GUICtrlCreateLabel("Number Of Columns", 14, 60, 94, 18) Local $hStandardCols = GUICtrlCreateInput("0", 104 +14, 55, 50, 20, BitOR($WS_TABSTOP, $ES_CENTER, $ES_NUMBER)) GUICtrlSetFont(-1, 10) GUICtrlCreateLabel("Number Of Rows", 14, 83, 90, 18) Local $hStandardRows = GUICtrlCreateInput("0", 104 +14, 81, 50, 20, BitOR($WS_TABSTOP, $ES_CENTER, $ES_NUMBER)) GUICtrlSetFont(-1, 10) GUICtrlCreateLabel("Table Indices", 14, 114, 120, 20) GUICtrlSetColor(-1, 0x008000) Local $hIndices = GUICtrlCreateCheckbox(" Enumerate First Column", 14, 137, 160, 20) ; REMEMBER YES, SETTINGS NO Local $hPadding = GUICtrlCreateCheckbox(" Include Leading Zeros", 14, 161, 124, 20) ; REMEMBER YES, SETTINGS NO GUICtrlCreateTabItem("Advanced") GUICtrlCreateLabel("Column 1 = Date Range", 14, 35, 120, 20) GUICtrlSetColor(-1, 0x008000) GUICtrlCreateLabel("Start Date", 14, 35 +20, 100, 20) Local $idDate1 = GUICtrlCreateDate("", 14, 56 +20, 105, 20, $WS_TABSTOP) GUICtrlCreateLabel("End Date", $iWidth - 118, 35 +20, 100, 20) Local $idDate2 = GUICtrlCreateDate("", $iWidth - 118, 56 +20, 105, 20, BitOR($WS_TABSTOP, $DTS_RIGHTALIGN)) GUICtrlCreateLabel("Column 2 = Days Of The Week (Optional)", 14, 108, 220, 20) GUICtrlSetColor(-1, 0x008000) Local $hCheckBox = GUICtrlCreateCheckbox(" Include Days Of The Week ", 14, 128, 190, 20) ; REMEMBER YES, SETTINGS NO Local $hRadio1 = GUICtrlCreateRadio(" Use Short Name", 14, 151) Local $hRadio2 = GUICtrlCreateRadio(" Use Long Name", $iWidth - 118, 151) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetState($hRadio1, $GUI_DISABLE) ; check settings later GUICtrlSetState($hRadio2, $GUI_DISABLE) ; check settings later GUICtrlCreateLabel("Add More Columns", 14, 181, 222, 20) GUICtrlSetColor(-1, 0x008000) GUICtrlCreateLabel("Total Number Of Columns", 14, 182 +23, 129, 18) Local $hColNum = GUICtrlCreateInput("1", 130 +14, 182 +21, 50, 20, BitOR($WS_TABSTOP, $ES_CENTER, $ES_NUMBER)) ; REMEMBER YES, SETTINGS NO GUICtrlSetFont(-1, 10) GUICtrlCreateTabItem("") ; end tabitem definition Local $hCancel = GUICtrlCreateButton("Cancel", $iWidth -143, $iHeight -25, 66, 20) Local $hOkay = GUICtrlCreateButton("OK", $iWidth -69, $iHeight -25, 66, 20) GUISetState(@SW_SHOW) Local $msg2, $bDisable = True, $iMaxFields = 65000, $bStandardError = False, $iRows = 0, $iCols = 0, _ $sMonitorAdv = GUICtrlRead($idDate1) & GUICtrlRead($idDate2) & GUICtrlRead($hColNum), $sDate1, $sDate2, $sColsAdv, $iDiff, $bErrorAdv = False While 1 $msg2 = GUIGetMsg() If $msg2 = $hCancel Or $msg2 = $GUI_EVENT_CLOSE Then ExitLoop If BitAND(GUICtrlRead($hCheckBox), $GUI_CHECKED) == $GUI_CHECKED Then If $bDisable Then GUICtrlSetState($hRadio1, $GUI_ENABLE) GUICtrlSetState($hRadio2, $GUI_ENABLE) $bDisable = False EndIf ElseIf Not $bDisable Then GUICtrlSetState($hRadio1, $GUI_DISABLE) GUICtrlSetState($hRadio2, $GUI_DISABLE) $bDisable = True EndIf $sDate1 = GUICtrlRead($idDate1) $sDate2 = GUICtrlRead($idDate2) $sColsAdv = GUICtrlRead($hColNum) If $sDate1 & $sDate2 & $sColsAdv <> $sMonitorAdv Then $iDiff = DateRange(LocaleDateToYMD($sDate1), LocaleDateToYMD($sDate2)) ; _DateDiff() is too limited If $iDiff * $sColsAdv > $iMaxFields Then If Not $bErrorAdv Then GUICtrlSetBkColor($hColNum, 0xFFA090) $bErrorAdv = True EndIf ElseIf $bErrorAdv Then GUICtrlSetBkColor($hColNum, 0xFFFFFF) $bErrorAdv = False EndIf $sMonitorAdv = $sDate1 & $sDate2 & $sColsAdv EndIf $iCols = GUICtrlRead($hStandardCols) $iRows = GUICtrlRead($hStandardRows) If Not $iRows Then GUICtrlSetData($hStandardRows, 0) If Not $iCols Then GUICtrlSetData($hStandardCols, 0) If ControlGetFocus($hChild) <> "Edit2" And StringRegExp($iRows, '\A0+[1-9]') Then GUICtrlSetData($hStandardRows, StringRegExpReplace($iRows, '(\A0+)([1-9])(\d+)*', '$2$3')) If ControlGetFocus($hChild) <> "Edit1" And StringRegExp($iCols, '\A0+[1-9]') Then GUICtrlSetData($hStandardCols, StringRegExpReplace($iCols, '(\A0+)([1-9])(\d+)*', '$2$3')) If $iRows > $iMaxFields Or $iCols > $iMaxFields Or GUICtrlRead($hStandardRows) * GUICtrlRead($hStandardCols) > $iMaxFields Then If Not $bStandardError Then GUICtrlSetBkColor($hStandardRows, 0xFFA090) GUICtrlSetBkColor($hStandardCols, 0xFFA090) $bStandardError = True EndIf ElseIf $bStandardError Then GUICtrlSetBkColor($hStandardRows, 0xFFFFFF) GUICtrlSetBkColor($hStandardCols, 0xFFFFFF) $bStandardError = False EndIf $iCols = GUICtrlRead($hColNum) If ControlGetFocus($hChild) <> "Edit3" And StringRegExp($iCols, '\A0+[1-9]') Then GUICtrlSetData($hColNum, StringRegExpReplace($iCols, '(\A0+)([1-9])(\d+)*', '$2$3')) $iCols = GUICtrlRead($hColNum) If $iCols < 1 Then If BitAND(GUICtrlRead($hCheckBox), $GUI_CHECKED) == $GUI_CHECKED And ControlGetFocus($hChild) <> "Edit3" Then GUICtrlSetData($hColNum, 2) Else GUICtrlSetData($hColNum, 1) EndIf If ControlGetFocus($hChild) = "Edit3" Then _GUICtrlEdit_SetSel($hColNum, 0, -1) EndIf If BitAND(GUICtrlRead($hCheckBox), $GUI_CHECKED) == $GUI_CHECKED Then If $iCols < 2 And ControlGetFocus($hChild) <> "Edit3" Then If ControlGetFocus($hChild) = "Button3" Then While _IsPressed('01') Sleep(20) WEnd EndIf If BitAND(GUICtrlRead($hCheckBox), $GUI_CHECKED) == $GUI_CHECKED Then GUICtrlSetData($hColNum, 2) Else GUICtrlSetData($hColNum, 1) EndIf EndIf Else If $iCols < 1 Then GUICtrlSetData($hColNum, 1) If ControlGetFocus($hChild) = "Edit3" Then _GUICtrlEdit_SetSel($hColNum, 0, -1) EndIf EndIf If $msg2 = $hOkay Then If $bErrorAdv Then MsgBox(262160, "uh-uh!", "Out of Range") ContinueLoop EndIf Local $sDelim = '-' ; read from settings ??? [maybe] If _GUICtrlTab_GetCurFocus($idTab) = 1 Then Local $iName, $sFormat = Default ; read from settings [ini] If BitAND(GUICtrlRead($hCheckBox), $GUI_CHECKED) == $GUI_CHECKED Then $iName = (BitAND(GUICtrlRead($hRadio1), $GUI_CHECKED) == $GUI_CHECKED) ? 3 : 2 Else $iName = -1 EndIf ; $sStartDate, $sStopDate, $sDelim = Default, $sFormat = Default, $iDayName = -1) GetDateArray(GUICtrlRead($idDate1), GUICtrlRead($idDate2), $sDelim, $sFormat, $iName) ; US [, '$3-$5-$1']) EndIf EndIf WEnd GUIDelete($hChild) EndFunc ;==> NewTable Func LocaleDateToYMD($sDate, $sDelim = '/') Local $iID = _WinAPI_GetUserDefaultLCID(), _ $aDateSplit = StringRegExp(_WinAPI_GetLocaleInfo($iID, $LOCALE_SSHORTDATE), '\w+', 3), _ $vTest = True ; [floating variable] If IsArray($aDateSplit) And UBound($aDateSplit) = 3 Then For $i = 0 To 2 ; determine the locale ymd order If StringInStr($aDateSplit[$i], 'y') Then $aDateSplit[$i] = 1 ; year ElseIf StringInStr($aDateSplit[$i], 'm') Then $aDateSplit[$i] = 2 ; month ElseIf StringInStr($aDateSplit[$i], 'd') Then $aDateSplit[$i] = 3 ; day EndIf Next $vTest = $aDateSplit[0] & $aDateSplit[1] & $aDateSplit[2] If StringInStr($vTest, '1') And StringInStr($vTest, '2') And StringInStr($vTest, '3') Then $vTest = False ; success EndIf If $vTest Then ; failure with the previous method [both methods work on Win7 in the UK] Local $sLongDate = _WinAPI_GetDateFormat(0, 0, $DATE_LONGDATE) $aDateSplit = StringRegExp($sLongDate, '(*UCP)\w+', 3) If Not IsArray($aDateSplit) And UBound($aDateSplit) <> 3 Then Return SetError(1) ; undetermined error? For $i = 0 To 2 ; determine the locale ymd order If $aDateSplit[$i] = @YEAR Then ; hopefully this method will work for all international regions $aDateSplit[$i] = 1 ; year ElseIf $aDateSplit[$i] = _DateToMonth(@MON, $DMW_LOCALE_LONGNAME) Then $aDateSplit[$i] = 2 ; month Else $aDateSplit[$i] = 3 ; day EndIf Next $vTest = $aDateSplit[0] & $aDateSplit[1] & $aDateSplit[2] If Not (StringInStr($vTest, '1') And StringInStr($vTest, '2') And StringInStr($vTest, '3')) Then Return SetError(2) ; undetermined error? EndIf Local $iCount = 1, $sYMD = '' Do For $i = 0 To 2 If $aDateSplit[$i] = $iCount Then $sYMD &= '$'& ($i*2 +1) & ($iCount <> 3 ? $sDelim : '') $iCount += 1 ExitLoop EndIf Next Until $iCount = 4 Return StringRegExpReplace($sDate, '(\d+)(\D)(\d+)(\D)(\d+)', $sYMD) EndFunc Func GetDateArray($sStartDate, $sStopDate, $sDelim = Default, $sFormat = Default, $iDayName = -1) Local $iID = _WinAPI_GetUserDefaultLCID(), _ $aDateSplit = StringRegExp(_WinAPI_GetLocaleInfo($iID, $LOCALE_SSHORTDATE), '\w+', 3) If IsArray($aDateSplit) And UBound($aDateSplit) = 3 Then For $i = 0 To 2 ; determine the locale ymd order If StringInStr($aDateSplit[$i], 'y') Then $aDateSplit[$i] = 1 ; year ElseIf StringInStr($aDateSplit[$i], 'm') Then $aDateSplit[$i] = 2 ; month ElseIf StringInStr($aDateSplit[$i], 'd') Then $aDateSplit[$i] = 3 ; day EndIf Next Else ; let's try an alternative method [both methods work on Win7 in the UK] Local $sLongDate = _WinAPI_GetDateFormat(0, 0, $DATE_LONGDATE) $aDateSplit = StringRegExp($sLongDate, '(*UCP)\w+', 3) If Not IsArray($aDateSplit) And UBound($aDateSplit) <> 3 Then Return SetError(1) ; undetermined error? For $i = 0 To 2 ; determine the locale ymd order If $aDateSplit[$i] = @YEAR Then ; hopefully this method will work for all international regions $aDateSplit[$i] = 1 ; year ElseIf $aDateSplit[$i] = _DateToMonth(@MON, $DMW_LOCALE_LONGNAME) Then $aDateSplit[$i] = 2 ; month Else $aDateSplit[$i] = 3 ; day EndIf Next EndIf ; check the array contains numbers 1 to 3 Local $sTest = $aDateSplit[0] & $aDateSplit[1] & $aDateSplit[2] If Not (StringInStr($sTest, '1') And StringInStr($sTest, '2') And StringInStr($sTest, '3')) Then Return SetError(2) ; undetermined error? If $sDelim = Default Then $sDelim = StringRegExp($sStartDate, '\D+', 3)[0] Local $iCount = 1, $sYMD = '' Do For $i = 0 To 2 If $aDateSplit[$i] = $iCount Then $sYMD &= '$'& ($i*2 +1) & ($iCount <> 3 ? $sDelim : '') $iCount += 1 ExitLoop EndIf Next Until $iCount = 4 $sStartDate = StringRegExpReplace($sStartDate, '(\d+)(\D)(\d+)(\D)(\d+)', $sYMD) $sStopDate = StringRegExpReplace($sStopDate, '(\d+)(\D)(\d+)(\D)(\d+)', $sYMD) Local $vReverse = False If $sStartDate > $sStopDate Then $vReverse = $sStartDate $sStartDate = $sStopDate $sStopDate = $vReverse EndIf ; internal format = yyyy/mm/dd Local $iStartYear = Number(StringRegExp($sStartDate, '\d+', 3)[0]), $iStopYear = Number(StringRegExp($sStopDate, '\d+', 3)[0]) Local $aTimeLine[(($iStopYear - $iStartYear +1) *366)] $iCount = 0 For $iYear = $iStartYear To $iStopYear For $iMon = 1 To 12 Switch $iMon Case 1, 3, 5, 7, 8, 10, 12 For $iDay = 1 To 31 ; this section of code can be shortened $aTimeLine[$iCount] = $iYear & $sDelim & StringFormat('%02i', $iMon) & $sDelim & StringFormat('%02i', $iDay) If $aTimeLine[$iCount] = $sStopDate Then ExitLoop 3 $iCount += 1 Next Case 4, 6, 9, 11 For $iDay = 1 To 30 $aTimeLine[$iCount] = $iYear & $sDelim & StringFormat('%02i', $iMon) & $sDelim & StringFormat('%02i', $iDay) If $aTimeLine[$iCount] = $sStopDate Then ExitLoop 3 $iCount += 1 Next Case Else For $iDay = 1 To IsLeapYear($iYear) ? 29 : 28 $aTimeLine[$iCount] = $iYear & $sDelim & StringFormat('%02i', $iMon) & $sDelim & StringFormat('%02i', $iDay) If $aTimeLine[$iCount] = $sStopDate Then ExitLoop 3 $iCount += 1 Next EndSwitch Next Next ReDim $aTimeLine[$iCount +1] ; get rid of unused elements For $i = 0 To UBound($aTimeLine) -1 If $aTimeLine[$i] = $sStartDate Then _DeleteRegion($aTimeLine, 1, 0, $i) ExitLoop EndIf Next _Predim($aTimeLine, 2) ; add 2nd dimension ; adding a day name column only works for start dates up to christmas day 2999 [millennium bug], is it worth fixing? ==> [FIXED] If $iDayName <> -1 Then ; $iDayName set to -1 because _DateDayOfWeek() format values range from 0 to 3 ReDim $aTimeLine[UBound($aTimeLine)][2] Local $aNextDay, $iDayNum If $sStartDate <= ('2999' & $sDelim & '12' & $sDelim & '25') Then For $i = 0 To 6 If $i = UBound($aTimeLine) Then ExitLoop $aNextDay = StringRegExp($aTimeLine[$i][0], '\d+', 3) $iDayNum = _DateToDayOfWeek (Number($aNextDay[0]), Number($aNextDay[1]), Number($aNextDay[2])) $aTimeLine[$i][1] = _DateDayOfWeek($iDayNum, $iDayName) Next For $i = 7 To UBound($aTimeLine) -1 $aTimeLine[$i][1] = $aTimeLine[Mod($i, 7)][1] Next Else Local $aDayName[7] For $i = 25 To 31 $aNextDay = StringRegExp('2999/12/' & $i, '\d+', 3) $iDayNum = _DateToDayOfWeek (Number($aNextDay[0]), Number($aNextDay[1]), Number($aNextDay[2])) $aDayName[$i -25] = _DateDayOfWeek($iDayNum, $iDayName) Next Local $iDateDiff = DateRange('2999/12/25', StringReplace($aTimeLine[0][0], $sDelim, '/')) For $i = 0 to 6 If $i = UBound($aTimeLine) Then ExitLoop $aTimeLine[$i][1] = $aDayName[Mod($iDateDiff + $i -1, 7)] Next For $i = 7 To UBound($aTimeLine) -1 $aTimeLine[$i][1] = $aTimeLine[Mod($i, 7)][1] Next EndIf EndIf If $sFormat = Default Then ; [regexp pattern stored in ini or settings] $aDateSplit = StringRegExp($sYMD, '\d', 3) _Predim($aDateSplit, 2) ReDim $aDateSplit[3][2] $aDateSplit[0][1] = 1 $aDateSplit[1][1] = 3 $aDateSplit[2][1] = 5 _ArraySort($aDateSplit) $sFormat = '$' & $aDateSplit[0][1] & $sDelim & '$' & $aDateSplit[1][1] & $sDelim & '$' & $aDateSplit[2][1] EndIf For $i = 0 To UBound($aTimeLine) -1 $aTimeLine[$i][0] = StringRegExpReplace($aTimeLine[$i][0], '(\d+)(\D)(\d+)(\D)(\d+)', $sFormat) Next If $vReverse Then _ReverseArray($aTimeLine) _ArrayDisplay($aTimeLine) Return $aTimeLine EndFunc ;==> GetDateArray Func IsLeapYear($iYear) If Mod($iYear, 4) Then Return False ElseIf Mod($iYear, 100) Then Return True ElseIf Mod($iYear, 400) Then Return False Else Return True EndIf EndFunc ;==> IsLeapYear Func DateRange($sDate1, $sDate2) ; must be yyyy/mm/dd Local $vTemp If $sDate1 > $sDate2 Then $vTemp = $sDate1 $sDate1 = $sDate2 $sDate2 = $vTemp EndIf Local $aArray1 = StringRegExp($sDate1, '\d+', 3), $aArray2 = StringRegExp($sDate2, '\d+', 3) For $i = 0 To 2 $aArray1[$i] = Number($aArray1[$i]) $aArray2[$i] = Number($aArray2[$i]) Next Local $iCount = 0 For $i = $aArray1[0] +1 To $aArray2[0] -1 If Not IsLeapYear($i) Then $iCount += 365 Else $iCount += 366 EndIf Next Local $iFirstMonth = 0 Switch $aArray1[1] Case 1, 3, 5, 7, 8, 10, 12 $iFirstMonth = 32 - $aArray1[2] Case 4, 6, 9, 11 $iFirstMonth = 31 - $aArray1[2] Case Else $iFirstMonth = (IsLeapYear($aArray1[0]) ? 30 : 29) - $aArray1[2] EndSwitch If $aArray1[0] < $aArray2[0] Then $iCount += $iFirstMonth For $i = $aArray1[1] +1 to 12 Switch $i Case 1, 3, 5, 7, 8, 10, 12 $iCount += 31 Case 4, 6, 9, 11 $iCount += 30 Case Else $iCount += (IsLeapYear($aArray1[0]) ? 29 : 28) EndSwitch Next $iCount += $aArray2[2] ; add remaining days in final month If $aArray2[1] > 1 Then For $i = 1 To $aArray2[1] -1 Switch $i Case 1, 3, 5, 7, 8, 10, 12 $iCount += 31 Case 4, 6, 9, 11 $iCount += 30 Case Else $iCount += (IsLeapYear($aArray2[0]) ? 29 : 28) EndSwitch Next EndIf ElseIf $aArray1[1] < $aArray2[1] Then ; same year, different month $iCount += $iFirstMonth For $i = $aArray1[1] +1 to $aArray2[1] -1 Switch $i Case 1, 3, 5, 7, 8, 10, 12 $iCount += 31 Case 4, 6, 9, 11 $iCount += 30 Case Else $iCount += (IsLeapYear($aArray1[0]) ? 29 : 28) EndSwitch Next $iCount += $aArray2[2] Else ; same month and year $iCount = $aArray2[2] - $aArray1[2] +1 EndIf Return $iCount EndFunc ;==> DateRange ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Functions from ArrayWorkshop.au3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #Au3Stripper_Off Func _ReverseArray(ByRef $aArray, $iDimension = 1, $iStart = 0, $iEnd = -1) If Not IsArray($aArray) Or UBound($aArray, 0) > 9 Then Return SetError(1) ; not a valid array Local $aBound = __GetBounds($aArray) If @error Then Return SetError(2) ; array contains zero elements $iDimension = ($iDimension = Default) ? 1 : Int($iDimension) If $iDimension < 1 Or $iDimension > $aBound[0] Then Return SetError(3) ; dimension does not exist $iStart = ($iStart = Default) ? 0 : Int($iStart) If $iStart < 0 Or $iStart > $aBound[$iDimension] - 2 Then Return SetError(4) ; meaningless $iStart value $iEnd = ($iEnd = -1 Or $iEnd = Default) ? $aBound[$iDimension] - 1 : Int($iEnd) If $iEnd <= $iStart Or $iEnd >= $aBound[$iDimension] Then Return SetError(5) ; meaningless $iEnd value If $aBound[0] = 1 Then ___Reverse1D($aArray, $iStart, $iEnd) Else $aBound[$iDimension] = 1 Local $aRegion = ___NewArray($aBound) ; to store extracted regions For $i = 1 To $aBound[0] $aBound[$i] -= 1 Next Local $sIndices = __HiddenIndices($aBound[0], $iDimension), $fnFloodFill = __FloodFunc()[$aBound[0]], _ $sTransfer = '$aSource' & $sIndices ; array syntax While $iEnd > $iStart $fnFloodFill($aRegion, $aBound, $iDimension, 0, $iStart, $aArray, $sTransfer) ; extract the current start region $sTransfer = '$aTarget' & $sIndices $fnFloodFill($aArray, $aBound, $iDimension, $iStart, $iEnd, '', $sTransfer) ; overwrite the current start region $sTransfer = '$aSource' & $sIndices $fnFloodFill($aArray, $aBound, $iDimension, $iEnd, 0, $aRegion, $sTransfer) ; overwrite the current end region $iStart += 1 $iEnd -= 1 WEnd EndIf EndFunc ;==>_ReverseArray Func _DeleteRegion(ByRef $aArray, $iDimension = 1, $iSubIndex = 0, $iRange = 1) If Not IsArray($aArray) Then Return SetError(1) Local $aBound = __GetBounds($aArray) ; get the bounds of each dimension If @error Then Return SetError(4) ; $aArray must contain at least one element If $aBound[0] > 9 Then Return SetError(2) ; nine dimension limit $iDimension = ($iDimension = Default) ? 1 : Int($iDimension) If $iDimension > $aBound[0] Or $iDimension < 1 Then Return SetError(3) ; out of bounds dimension $iSubIndex = ($iSubIndex = Default) ? 0 : Int($iSubIndex) If $iSubIndex < 0 Or $iSubIndex > $aBound[$iDimension] - 1 Then Return SetError(5) ; sub-index does not exist in the dimension $iRange = ($iRange = Default) ? 1 : Int($iRange) If $iRange < 1 Then Return SetError(6) ; range must be greater than zero $iRange = ($iSubIndex + $iRange < $aBound[$iDimension]) ? $iRange : $aBound[$iDimension] - $iSubIndex ; corrects for overflow If $iRange = $aBound[$iDimension] Then Return SetError(6) ; deleting the whole region is not currently supported [give reason] $aBound[$iDimension] -= $iRange ; the size of the dimension in the new array If $aBound[0] = 1 Then For $iNext = $iSubIndex To $aBound[$iDimension] - 1 $aArray[$iNext] = $aArray[$iNext + $iRange] Next ReDim $aArray[$aBound[$iDimension]] Return EndIf Local $iMaxIndex = $aBound[$iDimension] - 1 For $i = 1 To $aBound[0] $aBound[$i] -= 1 Next $aBound[$iDimension] = 0 ; set to loop once [one region at a time] Local $iFrom, $sTransfer = '$aTarget' & __HiddenIndices($aBound[0], $iDimension), $fnFloodFill = __FloodFunc()[$aBound[0]] For $iNext = $iSubIndex To $iMaxIndex $iFrom = $iNext + $iRange $fnFloodFill($aArray, $aBound, $iDimension, $iNext, $iFrom, '', $sTransfer) ; overwrite the final [untouched] region Next $aBound[$iDimension] = $iMaxIndex For $i = 1 To $aBound[0] $aBound[$i] += 1 Next __ResetBounds($aArray, $aBound) ; delete remaining indices EndFunc ;==>_DeleteRegion Func _PreDim(ByRef $aArray, $iDimensions, $bPush = False) If Not IsArray($aArray) Then Return SetError(1) $iDimensions = Int($iDimensions) If $iDimensions < 1 Or $iDimensions > 9 Then Return SetError(2) Local $iPreDims = UBound($aArray, 0) ; current number of dimensions If $iPreDims = $iDimensions Then Return ; no change If $iPreDims > 9 Then Return SetError(3) ; too many dimensions Local $aBound = __GetBounds($aArray) ; get the size of each original dimension If @error Then Return SetError(4) ; $aArray must contain at least one element $aBound[0] = $iDimensions ; overwrite this value with the new number of dimensions Local $sTransfer = '[$a[1]][$a[2]][$a[3]][$a[4]][$a[5]][$a[6]][$a[7]][$a[8]][$a[9]]' ; array syntax to be sent to the remote loop region If $bPush Then ; prefix dimensions, or delete from the left Local $iOffset = Abs($iDimensions - $iPreDims) If $iPreDims > $iDimensions Then ; lower dimensions get deleted For $i = 1 To $iDimensions ; shift elements to lower indices $aBound[$i] = $aBound[$i + $iOffset] Next $sTransfer = '$aSource' & StringLeft('[0][0][0][0][0][0][0][0]', $iOffset * 3) & StringLeft($sTransfer, $iDimensions * 7) Else ; lower dimensions are created ReDim $aBound[$iDimensions + 1] ; make space for more dimensions For $i = $iDimensions To $iOffset + 1 Step -1 ; shift elements to higher indices $aBound[$i] = $aBound[$i - $iOffset] Next For $i = 1 To $iOffset ; assign the size of each additional dimension [1][1][1]... etc... $aBound[$i] = 1 Next $sTransfer = '$aSource' & StringMid($sTransfer, 1 + $iOffset * 7, $iPreDims * 7) EndIf Else ; Default behaviour = append dimensions, or delete from the right ReDim $aBound[$iDimensions + 1] ; modify the number of dimensions [according to the new array] For $i = $iPreDims + 1 To $iDimensions ; assign the size of each new dimension ...[1][1][1] etc... $aBound[$i] = 1 Next $sTransfer = '$aSource' & StringLeft($sTransfer, $iPreDims * 7) EndIf ; add or remove dimensions Local $aNewArray = ___NewArray($aBound) For $i = 1 To $iDimensions $aBound[$i] -= 1 ; convert elements to the maximum index value within each dimension Next ; access the remote loop region Local $iSubIndex = 0, $aFloodFill = __FloodFunc() $aFloodFill[$iDimensions]($aNewArray, $aBound, 0, $iSubIndex, '', $aArray, $sTransfer) $aArray = $aNewArray EndFunc ;==>_PreDim Func __GetBounds($aArray, $iHypothetical = 0) Local $iMaxDim = UBound($aArray, 0) Local $aBound[($iHypothetical ? $iHypothetical : $iMaxDim) + 1] ; [or ==> Local $aBound[9]] $aBound[0] = $iMaxDim For $i = 1 To $iMaxDim $aBound[$i] = UBound($aArray, $i) If $aBound[$i] = 0 Then Return SetError(1) Next If $iHypothetical Then For $i = $iMaxDim + 1 To $iHypothetical $aBound[$i] = 1 ; imaginary dimensions Next EndIf Return $aBound EndFunc ;==>__GetBounds Func __HiddenIndices($iBound, $iDimension) Local $sSyntax = '' ; to access elements at their original indices For $i = 1 To $iBound If $i <> $iDimension Then $sSyntax &= '[$a[' & $i & ']]' ; default ==> '$aSource[$iFrom][$a[2]][$a[3]][$a[4]][$a[5]] etc...' Else $sSyntax &= '[$iFrom]' EndIf Next Return $sSyntax EndFunc ;==>__HiddenIndices Func ___NewArray($aBound) Switch $aBound[0] Case 1 Local $aArray[$aBound[1]] Case 2 Local $aArray[$aBound[1]][$aBound[2]] Case 3 Local $aArray[$aBound[1]][$aBound[2]][$aBound[3]] Case 4 Local $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]] Case 5 Local $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]] Case 6 Local $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]][$aBound[6]] Case 7 Local $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]][$aBound[6]][$aBound[7]] Case 8 Local $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]][$aBound[6]][$aBound[7]][$aBound[8]] Case 9 Local $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]][$aBound[6]][$aBound[7]][$aBound[8]][$aBound[9]] EndSwitch Return $aArray EndFunc ;==>___NewArray Func ___Reverse1D(ByRef $aArray, $iStart, $iStop) Local $vTemp While $iStop > $iStart $vTemp = $aArray[$iStart] $aArray[$iStart] = $aArray[$iStop] $aArray[$iStop] = $vTemp $iStart += 1 $iStop -= 1 WEnd EndFunc ;==>___Reverse1D Func __ResetBounds(ByRef $aArray, $aBound) Switch $aBound[0] Case 1 ReDim $aArray[$aBound[1]] Case 2 ReDim $aArray[$aBound[1]][$aBound[2]] Case 3 ReDim $aArray[$aBound[1]][$aBound[2]][$aBound[3]] Case 4 ReDim $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]] Case 5 ReDim $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]] Case 6 ReDim $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]][$aBound[6]] Case 7 ReDim $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]][$aBound[6]][$aBound[7]] Case 8 ReDim $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]][$aBound[6]][$aBound[7]][$aBound[8]] Case 9 ReDim $aArray[$aBound[1]][$aBound[2]][$aBound[3]][$aBound[4]][$aBound[5]][$aBound[6]][$aBound[7]][$aBound[8]][$aBound[9]] EndSwitch EndFunc ;==>__ResetBounds Func __FloodFunc() ; [modified for this demo] Local $aFloodFunc = ['', ___Flood1D, ___Flood2D] ; , ___Flood3D, ___Flood4D, ___Flood5D, ___Flood6D, ___Flood7D, ___Flood8D, ___Flood9D] Return $aFloodFunc EndFunc ;==>__FloodFunc Func ___Flood1D(ByRef $aTarget, $aBound, $iDimension, $iSubIndex, $iFrom, $aSource, $sTransfer) ; [still experimental] #forceref $iDimension, $iFrom, $aSource ; $iDimension would normally not apply here (special case) Local $a[10] = ['', 0, 0, 0, 0, 0, 0, 0, 0, 0] ; loop iteration count [or indices of higher dimensions within the source array] For $a[1] = $iSubIndex To $aBound[1] ; from the start to the bounds of the 1st dimension (special case) ; only one operation is needed in this special case $aTarget[$a[1]] = Execute($sTransfer) ; hidden parameters may appear in the code being executed Next EndFunc ;==>___Flood1D Func ___Flood2D(ByRef $aTarget, $aBound, $iDimension, $iSubIndex, $iFrom, $aSource, $sTransfer) #forceref $iFrom, $aSource ; hidden parameters Local $a[10] = ['', 0, 0, 0, 0, 0, 0, 0, 0, 0] ; loop iteration count [or indices of higher dimensions within the source array] For $a[2] = 0 To $aBound[2] For $a[1] = 0 To $aBound[1] $a[$iDimension] = $iSubIndex ; override the iteration count (fast method) - $a[0] has no influence $aTarget[$a[1]][$a[2]] = Execute($sTransfer) ; hidden parameters may appear in the code being executed Next Next EndFunc ;==>___Flood2D #Au3Stripper_On
  6. Hello guys, i have a problem in this regex because its not groupping right. Look: (\d{1,2}\s?[\055|\056|\057|\134]\s?\d{1,2}(\s?[\055|\056|\057|\134]\s?\d{2,4})?) It checks for day or dayday, month or monthmonth, yearyear or yearyearyear+year. separated with or without space and the characters "\/.-" But, a problem! I tried to regex the date with or without the "separator + year" Eg: 05/05 or 05/05/05, but when i have 05/05/05, regex are separating 05/05 and /05 Iam using group "()" wrong? Need help here Thx adv! ~~EDIT: Script used: (from autoitscript.com/forum/topic/129697-split-string-by-regular-expression/#comment-901335) #include <Array.au3> Local $sString = ClipGet() ; Extract the delimiters $aDelim = StringRegExp($sString, '(\d{1,2}\s?[\055|\056|\057|\134]\s?\d{1,2}(\s?[\055|\056|\057|\134]\s?\d{2,4})?)', 3) ; Split the string on the delimiters $aParts = StringSplit(StringRegExpReplace($sString, '(\d{1,2}\s?[\055|\056|\057|\134]\s?\d{1,2}(\s?[\055|\056|\057|\134]\s?\d{2,4})?)', "$<SEPARATOR>$"), "$<SEPARATOR>$", 3) ; Add the delimter to the start of the part For $i = 0 To UBound($aParts) - 1 ;$aParts[$i + 1] = $aDelim[$i] & $aParts[$i + 1] Next ; Set the count $aParts[0] = UBound($aParts) ; Display the result _ArrayDisplay($aParts) _ArrayDisplay($aDelim) Results in array: (the array parts in all string is ok; but the string delimitator himself is getting separated in every string that have year together) String used as test: Cheers.
  7. I've created a simple script that opens the Snipping Tool; Selects the "Full Screen Snip" option; then closes the program, prompting a save. What I can't figure is how to name the file using the system date and time. Can anyone help? Run(@WindowsDir & '\system32\SnippingTool.exe') AutoItSetOption('MouseCoordMode', 0) Sleep(1) $hWnd= WinWait("Snipping Tool", "ToolBarWindow32", 1) WinActive($hWnd) MouseClick('primary', 84, 48, 1, 0) MouseClick('primary', 84, 140, 1, 0) WinClose("[Class:Microsoft-Windows-Tablet-SnipperEditor]") ControlClick("Snipping Tool", "", "Button1")
  8. I have another AutoIT script making a Log file Sample of Log file: 2016/08/22 12:44:18 > Process: [RUNNING] [ACTIVE] 2016/08/22 12:48:35 > Process: [WAS NOT RUNNING] 2016/08/22 13:40:00 > Process: [FAILED] 2016/08/22 14:01:10 > Process: [WAS NOT RUNNING] I am looping through the Log file for the word "FAILED" I then want to get all lines that have "FAILED" and get their TIME My Current code to get this far: If FileExists($fileLog) Then $contents = FileRead($fileLog) If @error Then MsgBox(0, 'File Error', $fileLog & ' could not be read.') Else For $i = 1 To _FileCountLines($fileLog) $result = StringInStr($contents,$search) If $result >= 1 Then $filteredLine = FileReadLine($fileLog,$i) If StringInStr($filteredLine,$search) Then ConsoleWrite($filteredLine & @CRLF) ; this gets me the results I want sans the time parse EndIf Else ConsoleWrite( $search & " not found!" & @CRLF) EndIf Next EndIf EndIf For this part: If StringInStr($filteredLine,$search) Then ConsoleWrite($filteredLine & @CRLF) ; this gets me the results I want sans the time parse EndIf OUTPUT: 2016/08/22 13:40:00 > Process: [FAILED] I dont understand how I read the time in that output? I have tried _DateTimeFormat - Dont think this applies Tried _DateDiff - I dont have a the date yet so this doesnt work Would love if someone could tell me if I am thinking is the wrong direction and possibly lead me down the correct path to light side of the force
  9. Hi to all My problem is how can I compare two dates if I have the following code: $date = _NowDate() $dateend = "10/12/2016" if $date > $dateend Then Exit EndIf It does not work well I guess it's because I'm comparing two strings not realy two dates. My idea would break the date into three numbers year, month and day and go comparing data as numbers. is this correct...? Thank's to all
  10. I am assigning the current time stamp to a variable $strtTime and holding the execution for 5 seconds with Sleep and calculating the current time stamp. Ideally, the _DateDiff should give 5 seconds as output as i gave the parameter as s.But it is giving zero 0. Any suggestions....! Global $startTime = _Date_Time_GetLocalTime() $startTime = _Date_Time_SystemTimeToDateTimeStr($startTime) Sleep(5000)     $tCur = _Date_Time_GetLocalTime()     $tCur = _Date_Time_SystemTimeToDateTimeStr($tCur) $iDateCalc = _DateDiff('s', $startTime, $tCur)     MsgBox(0,"$iDateCalc",$iDateCalc)     FileWrite ($QTPfile,CHr(34) & $tCur & CHr(34) & Chr(44) & """" & $iDateCalc & """,")
  11. hi I'm trying to make a script that runs different functions depending on the local time of the computer I tried to do if _NowCalcDate < 2016/04/12 Then functionA() Else functionB() Endif and that doesn't seem to work. I am assuming that value returned from _NowCalcDate doesn't match with the date type I wrote What should I do? I'd appreciate for any help that's given.
  12. Even if I know about the existence of the _GUICtrlMonthCal* functions, here is a simple home made "Visual date chooser" function. It is in a raw draft format and can likely be emprooved, but I think that, all in all, this "skeleton" is not so bad. Maybe it can be of use... ; Calendar mini #include <date.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GUIEdit.au3> #include <WinAPI.au3> #include <StaticConstants.au3> Local $aResult = _Peek_A_Date() MsgBox(0, 'Result', (@error) ? 'No date selected' : _DateTimeFormat($aResult[0] & "/" & $aResult[1] & "/" & $aResult[2], 1), 3) ; ---------------------------------------------------------------------------------- ; a simple 'visual' date peeker function ; parameters are optional ; YYYY and MM for initial desired calendar ; last parameter: if true (default) first weekday is moonday ; if false first weekday is sunday ; returns: on success a 3 elements array as [0]Year yyyy; [1]Monthh mm; [2]Day dd ; on error set @error and returns 0 ; ----------------------------------------------------------------------------------- Func _Peek_A_Date($iYear = @YEAR, $iMonth = @MON, $bISO = True) Local $hCalendar = GUICreate('', 210, 160, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW), $iDay = @MDAY Local $IdDate = GUICtrlCreateLabel('', 25, 4, 160, 20, $SS_CENTER, $GUI_WS_EX_PARENTDRAG), $idWeekDays = GUICtrlCreateLabel('', 2, 28, 206, 20) Local $idDays = GUICtrlCreateEdit('', 2, 50, 206, 108, BitOR($ES_READONLY, $ES_MULTILINE), 0), $hDays = GUICtrlGetHandle(-1) Local $iColor = 0x00ffd700, $Dummy = GUICtrlSetBkColor(-1, $iColor) + GUICtrlSetCursor(-1, 0) Local $Dummy = GUICtrlSetFont($idWeekDays, 12, -1, -1, 'courier new') + GUICtrlSetFont($idDays, 12, -1, -1, 'courier new') + GUICtrlSetFont($IdDate, 10, 700) ; 'courier new') Local $idPrevMonth = GUICtrlCreateButton('<', 2, 2, 18, 18), $idNextMonth = GUICtrlCreateButton('>', 190, 2, 18, 18) Local $sDaysOfWeek = '', $aDate[3] = [$iYear, $iMonth, $iDay], $aBounds, $aCharPos, $sLine, $s $iYear = 0 For $i = 1 To 7 $sDaysOfWeek &= StringLeft(_DateDayOfWeek($i, $DMW_LOCALE_SHORTNAME), 2) & " " Next $sDaysOfWeek = ($bISO) ? StringMid($sDaysOfWeek, 4) & StringLeft($sDaysOfWeek, 2) : StringLeft($sDaysOfWeek, 20) GUICtrlSetData($idWeekDays, $sDaysOfWeek) Local $sDays = ' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31' GUISetBkColor($iColor) GUISetState(@SW_SHOW) Local $aBounds[2] = [($bISO) ?(_DateToDayOfWeekISO($aDate[0], $aDate[1], 1)) :(_DateToDayOfWeek($aDate[0], $aDate[1], 1)), _DateDaysInMonth($aDate[0], $aDate[1])] While WinActive($hCalendar) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN $aDate[2] = $s If _DateIsValid($aDate[0] & "/" & $aDate[1] & '/' & $aDate[2]) Then ToolTip('') GUIDelete($hCalendar) Return SetError(0, 0, $aDate) EndIf Case $GUI_EVENT_MOUSEMOVE ; https://www.autoitscript.com/forum/topic/157899-get-text-word-under-the-mouse-pointer/?do=findComment&comment=1145318 ; (portions of code by Malkey) $aCharPos = _GUICtrlEdit_CharFromPos($hDays, _WinAPI_GetMousePosX(True, $hDays), _WinAPI_GetMousePosY(True, $hDays)) $sLine = _GUICtrlEdit_GetLine($hDays, $aCharPos[1]) $aCharPos[0] -= _GUICtrlEdit_LineIndex($hDays, $aCharPos[1]) $s = (StringMid($sLine, $aCharPos[0] + 1, 1) == " ") ? "" : StringRegExpReplace($sLine, "(?s)^.{0," & $aCharPos[0] & "}(?: |^)([^ ]*).*$", "\1") ToolTip(($s = "") ? "" : _DateTimeFormat($aDate[0] & "/" & $aDate[1] & "/" & $s, 2)) Case $idPrevMonth $aDate = StringSplit(_DateAdd('M', -1, $aDate[0] & "/" & $aDate[1] & '/1'), '/', 2) Case $idNextMonth $aDate = StringSplit(_DateAdd('M', +1, $aDate[0] & "/" & $aDate[1] & '/1'), '/', 2) EndSwitch If $iYear <> $aDate[0] Or $iMonth <> $aDate[1] Then $iYear = $aDate[0] $iMonth = $aDate[1] $aBounds[0] = ($bISO) ?(_DateToDayOfWeekISO($aDate[0], $aDate[1], 1)) :(_DateToDayOfWeek($aDate[0], $aDate[1], 1)) $aBounds[1] = _DateDaysInMonth($aDate[0], $aDate[1]) GUICtrlSetData($idDays, StringLeft(StringLeft(StringFormat('%' & 18 & 's', ""), 3 * ($aBounds[0] - 1)) & _ StringTrimRight($sDays, (31 - $aBounds[1]) * 3) & StringFormat('%' & 40 & 's', ""), 126)) GUICtrlSetData($IdDate, _DateToMonth($aDate[1], $DMW_LOCALE_LONGNAME) & " " & $aDate[0]) EndIf ; WEnd GUIDelete($hCalendar) Return SetError(1, 0, 0) EndFunc ;==>_Peek_A_Date
  13. I am very novice to autoit and I have searched around but cannot seem to find the answer to what seems to be a simple questions. I would like to set a local variable equal to today's date. Local $Todate $Todate = 'todays date in the format of mm/dd/yyyy Any help would be greatly apprciated
  14. I want to check if the system time has added to 10minutes so I used this: $sNewDate = _DateAdd('n', 15, _NowCalc()) $sNewDate2 = _DateAdd('n', 0, _NowCalc()) ConsoleWrite("current time now: " & $sNewDate2) ConsoleWrite("time after 15minutes: " & $sNewDate)this print me out .... 2016/01/12 10:04:55 and .... 2016/01/12 10:14:55 and but how can I make a statement like if $sNewDate2 has + 15minutes so I can do something after the check.
  15. I am trying to dynamically get folders and their modification date, I was orientated by this: ; Initial Launch, grab current GetTime $file1_1 = FileGetTime("X:\aescripts\testimg", 0, 1) Timecheck() Func Timecheck() $file1_2 = FileGetTime("X:\test\testimg", 0, 1) If $file1_1 == $file1_2 Then ConsoleWrite("Folder 1 not modified" & @CRLF); ElseIf $file1_1 <> $file1_2 Then ConsoleWrite("Folder 1 modified" & @CRLF) EndIf ; Initial Launch, grab current GetTime $file1_1 = FileGetTime("X:\test\testimg", 0, 1) EndFunc ; Initial Launch, grab current GetTime $file1_1 = FileGetTime("X:\test\testimg", 0, 1) While 1 Sleep(5000) Timecheck() WEnd That works, but it is not dynamic. So I did code following but it does not work properly.    Local $sFootage_01 = "Z:\Footage\ClothImgs\"    Local $aFileListFootageFolder_01 = _FileListToArray($sFootage_01, "*") ; Initial Launch, grab current GetTime For $i = 0 To UBound($aFileListFootageFolder_01) - 1 $newFootageFolder_01 = $sFootage_01 & $aFileListFootageFolder_01[$i] $getTimeNewFootageFolderInit_01 = FileGetTime($newFootageFolder_01, 0, 1) ConsoleWrite("First Filename " & $newFootageFolder_01 & @CRLF) Next Func Timecheck() Local $aFileListFootageFolderRe_01 = _FileListToArray($sFootage_01, "*") If @error = 1 Then ConsoleWrite("not valid path" & @CRLF) Exit EndIf If @error = 4 Then ConsoleWrite("could not find any data" & @CRLF) Exit EndIf For $i = 0 To UBound($aFileListFootageFolderRe_01) - 1 $newFootageFolder_01 = $sFootage_01 & $aFileListFootageFolderRe_01[$i] ConsoleWrite("ArrH " & $aFileListFootageFolderRe_01[$i] & @CRLF) $getTimeNewFootageFolder_01 = FileGetTime($newFootageFolder_01, 0, 1) ConsoleWrite("ZZZ First Filename " & $newFootageFolder_01 & @CRLF) Local $aGetTimeNewFootageFolder_01 = _FileListToArray($newFootageFolder_01, "*") For $u = 0 To UBound($aGetTimeNewFootageFolder_01) -1 If $getTimeNewFootageFolderInit_01 == $getTimeNewFootageFolder_01 Then ConsoleWrite($newFootageFolder_01 & " has not been changed" & @CRLF) ElseIf($getTimeNewFootageFolderInit_01 <> $getTimeNewFootageFolder_01 And $aGetTimeNewFootageFolder_01[0] == 11) Then ConsoleWrite("File 1 has been changed and has " & $aGetTimeNewFootageFolder_01[0] & " images" & @CRLF) ConsoleWrite("Time 1.1: " & $getTimeNewFootageFolderInit_01 & @CRLF & "1.2: " & $getTimeNewFootageFolder_01 & @CRLF) WinKill($hWnd, "") Sleep(8000) RunCm() ListFolders() ExitLoop ElseIf($getTimeNewFootageFolderInit_01 <> $getTimeNewFootageFolder_01 And $aGetTimeNewFootageFolder_01[0] <> 11) Then ConsoleWrite("Path " & $newFootageFolder_01 & " modification date has changed, number of images: " & $aGetTimeNewFootageFolder_01[0] & " files/folders" & @CRLF) Else ConsoleWrite("Else Statement" & @CRLF) EndIf Next Next $aFileListFootageFolderInit_01 = _FileListToArray($sFootage_01, "*") ; Initial Launch, grab current GetTime For $i = 0 To UBound($aFileListFootageFolder_01) - 1 $newFootageFolder_01 = $sFootage_01 & $aFileListFootageFolder_01[$i] $getTimeNewFootageFolderInit_01 = FileGetTime($newFootageFolder_01, 0, 1) Next EndFunc $aFileListFootageFolderInit_01 = _FileListToArray($sFootage_01, "*") ; Initial Launch, grab current GetTime For $i = 0 To UBound($aFileListFootageFolder_01) - 1 $newFootageFolder_01 = $sFootage_01 & $aFileListFootageFolder_01[$i] $getTimeNewFootageFolderInit_01 = FileGetTime($newFootageFolder_01, 0, 1) Next ; check every 5s if files in footage folder has been changed While 1 Sleep(5000) ConsoleWrite("While Loop " & @CRLF) Timecheck() WEndIt always goes to the first ElseIf Statement and tells me that the files have been changed. So I printed out the modification dates and this varaible shows correctly the current modification date of the subfolder $getTimeNewFootageFolder_01 and this $getTimeNewFootageFolder_01 does show another modification date of another folder which I do not understand. Again the code (not dynmaic one) above works, but trying to make it dynmacly did not work.
  16. Hi there, I'm wanting to put in a line that determines whether the current date is passed the 'expired' date which is included in the code. I have the idea? But am not overly familiar in determining all the functions in the date.au3 extension. #include <Date.au3> Local $expdate = _SetDate(01, 02, 2016) Local $datediff = _DateDiff('D', $expdate, _NowCalc()) If $datediff = 0 Then MsgBox(0, "Expired", "Sorry, this program has expired, contact me for an extension.", 15) Exit EndIf And tried this: #include <Date.au3> Local $currdate = _Date_Time_GetSystemTime() Local $expdate = _SetDate(01, 02, 2015) If $currdate > $expdate Then MsgBox(0, "Expired", "Sorry, this program has expired, contact me for an extension.", 15) Exit EndIf Any assistance would be very appreciated. Thanks
  17. Whats is the best method to know if a specific folder has changed his files. In my case I want to check if pictures in my folder have been changed or not. (If someone is interest in future plans I want to count afterwards the files in that folder, but that is not important now) Can anyone help me out, I though of something like getting the current modification date and comparing it somehow with the future one but I do not know if something like that is even possible. SO basically again I "Just" want to check if a specific folder ( files in that folder) have been changed.
  18. Hey, I created a Date- and Timepicker in my GUI, I can get the date I selected (GUICtrlRead), but I want to compare it with the current date. I got this far: Func AddEntry() $hours = GUICtrlRead($input_hour) $minutes = GUICtrlRead($input_minutes) $seconds = GUICtrlRead($input_seconds) $date = GUICtrlRead($Date1) If @HOUR = $hours and @MIN = $minutes and @SEC = $seconds then MsgBox(0, "", "Time is right") ; @WDAY, @MON, @MDAY, @YEAR just give out number and I dont know how I can compare them with the "Monday, January 1, 2015" outputHope you can help!
  19. This program can be used to create simple alarms (msgbox or soundfile can be added to every alarm). The program is just running in background, if you close it. (Use Tooltip to exit.) I translated the Programm in english to post it here. If you like it, please leave me a comment, also if you have any suggestions to make it better or if you found bugs. For more information and direct executables, please visit my website: http://kanashius.de/?page=kalender kalenderfenster_source.zip
  20. Hello all.. I am trying to convert Active Directory computer account last used date to a readable format. I have some functions that will do this, but they use the following command to perform the command: w32tm /ntte <NT time epoch> Convert a NT system time, in (10^-7)s intervals from 0h 1-Jan 1601, into a readable format. This is super slow when dealing with thousands of records. Here is what I have so far... #include <array.au3> #include <DateTimeConvert.au3> #include <Date.au3> $exampleADTimeStamp = "130793861794571914" Msgbox(0,"MyResult", "Timestamp: " & $exampleADTimeStamp & @crlf & "Days since last Login: " & DateStringToDaysSinceLastLogin($exampleADTimeStamp)) Func DateStringToDaysSinceLastLogin($Timestamp) $ParseOutput = ParseLL($Timestamp) $ParseOutput = StringSplit($ParseOutput, " ", 2) $newFinal = _DateStandardToCalcDate($ParseOutput[0]) Return Abs(CompareD($newFinal)) EndFunc ;==>DateStringToDaysSinceLastLogin Func ParseLL($oLastLogon) $sOutput = "" $iPID = Run(@ComSpec & " /c " & "w32tm.exe /ntte " & $oLastLogon, @TempDir, @SW_HIDE, 2) While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd $sOutput = StringSplit($sOutput, " - ", 2 + 1) Return $sOutput[1] EndFunc ;==>ParseLL Func CompareD($Datez) Return _DateDiff("D", @YEAR & "/" & @MON & "/" & @MDAY, $Datez) EndFunc ;==>CompareD I'm sure there has got to be a better way to calculate this date format without having to use a command line tool, but after searching the forums, I haven't found anything.. Does anyone have any thoughts? Thanks in advance!!!
  21. ok i have found a lot of solutions when using datdiff etc but the issue is the excel file is coming back with dates like this: Date=Fri, 08 May 2015 how can i compare that date to today's date? i am getting today's date using this: Func _GetTodaysDate($iReturnTime = 1) Local $aMDay[8] = [7, "Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"], _ $aMonth[13] = [12, "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"], $aTime[2] = ["", ' ' & @HOUR & ':' & @MIN & ':' & '00'] Return $aMDay[@WDAY] & ', ' & @MDAY & ' ' & $aMonth[@MON] & ' ' & @YEAR & $aTime[$iReturnTime] EndFunc this will return: Sun, 10 May 2015 it would be nice to just compare like this: If $todaysDate < $iniDate thenI have looked at datdiff and stringcompare but that means i have to change the format of dates... which i can do using today's date but cant figure out how to take the Date=Fri, 08 May 2015 into a all numeric format any ideas?
  22. Hello, I am trying to look into multiple folders for outlook OST's. What I need is if there are more than one, delete the oldest one in that directory then move to the next directory. I am not to sure on how to compare and detect multiple OSTs in a folder. So far my script will search all the subdirectories in a given path and prompt me with the OST's found. How to I check for more than one OST and delete the oldest? Folder structure example: OSTS - user1 - User1.ost - User2 - User2.ost -User2_dup.ost Etc... ; Script Start - Add your code below here #include <Array.au3> ; Only required to display the arrays #include <File.au3> #include <MsgBoxConstants.au3> Local $sOSTDir = "\\server1\osts\" $aArray = _FileListToArrayRec($sOSTDir, "*.ost", $FLTAR_RECUR, $FLTAR_SORT) for $i = 1 to $aArray[0] $time = FileGetTime($sOSTDir & $aArray[$i], 2); 0 if for modified date $dmyyyy = $time[3]& ":" & $time[4] & ":" & $time[5]&'_'&$time[1]& "/" & $time[2] & "/" & $time[0] msgbox(0,"test", $aArray[$i] & " | Date: " & $dmyyyy) next Any help would be appreciated.
  23. I know to use _Excel_RangeRead to read the Column titles by: getting the list of Worksheets using _Excel_SheetList, open each worksheet etc etc but could I do it by using _Excel_RangeFind. Anyway I don't know the command to set the Range to "dd/mm/yyyy" Could anybody give me an example above? - setting the formatting please Joe
  24. Fed up of so many confusing formats? This is something for my text editor which can be used for ordering disorganized lines, with dates in them, into a timeline. The function _SortByDateFuzzy() attempts to put lines of text into sequential order using fuzzy date recognition. Default endianness is Little Endian (day/month/year sequence). The other two are of course very common: see link ==> http://en.wikipedia.org/wiki/Date_format_by_country ; #include <Array.au3> ; #FUNCTION# ==================================================================================================================== ; Name...........: _SortByDateFuzzy ; Description ...: Attempts to sort lines by date in multiline formated text such as CSV or similar. ; Syntax.........: _SortByDateFuzzy($sMultiline, [$Endianness = 1 [, $sLineBreak = @CRLF ]]) ; Parameters ....: $sMultiline - multiline formated text ; ; $Endianness - Default is day/month/year, set to 2 for month/day/year, set to 3 for year/month/day ; ; $sLineBreak - Default = CRLF. Only vertical space characters are allowed. ; Return values .: Success - Returns the text lines in a sequential timeline. ; Failure - Sets @error to the following: ; @error = 1 No input exists. ; @error = 2 Endianness not recognized. ; @error = 3 Incorrect linebreak characters detected. ; Author ........: czardas ; Modified.......: ; Remarks .......: This function looks for the first pattern it finds that looks like a date in each line. ; Days and months can be 1 or 2 digits, and years can be 2 or 4 digits. ; Two digit years are interpreted as being within the current century. ; The following 18 date formats (used in various countries worldwide) are supported: ; Little Endian 'd/m/y', 'd-m-y', 'd.m.y', 'd m y', 'd.m-y', 'd. m y' ; Middle Endian 'm/d/y', 'm-d-y', 'm.d.y', 'm d y', 'm d, y', 'm. d, y' ; Big Endian 'y/m/d', 'y-m-d', 'y.m.d', 'y m d', 'y. m. d', 'y. m d.' ; Lines not containing a recognisable date format are dumped at the end in the same order they are encountered. ; Limitation - If multiple formats occur in the same line, dates with two identical delimiters get priority. ; =============================================================================================================================== Func _SortByDateFuzzy($sMultiline, $Endianness = 1, $sLineBreak = @CRLF) If Not $sMultiline Then Return SetError(1) ; Invalid input. If $Endianness = Default Or $Endianness = "little endian" Then ; day/month/year $Endianness = 1 ElseIf $Endianness = "middle endian" Then ; month/day/year $Endianness = 2 ElseIf $Endianness = "big endian" Then ; year/month/day $Endianness = 3 EndIf If $sLineBreak = Default Then $sLineBreak = @CRLF If $sLineBreak = "" Or StringRegExp($sLineBreak, "\V") Then Return SetError(3) ; $sLineBreak must only contain vertical space characters. Local $iBound = 3 + ($Endianness = 1) Local $sReplace, $aPattern[$iBound] $aPattern[0] = $iBound -1 Switch $Endianness Case 1 ; Little Endian $aPattern[1] = '(?U)(.*)(\b\d{1,2})([\./ \-])(\d{1,2})(\g3)(\d{4}|\d{2}\b)(.*\z)' ; Delimiter repeats $aPattern[2] = '(?U)(.*)(\b\d{1,2})(\-)(\d{1,2})(\.)(\d{4}|\d{2}\b)(.*\z)' ; d-m.y $aPattern[3] = '(?U)(.*)(\b\d{1,2})(\. )(\d{1,2})( )(\d{4}|\d{2}\b)(.*\z)' ; d. m y $sReplace = "$6-$4-$2" Case 2 ; Middle Endian $aPattern[1] = '(?U)(.*)(\b\d{1,2})([\./ \-])(\d{1,2})(\g3)(\d{4}|\d{2}\b)(.*\z)' ; Delimiter repeats (same as above) $aPattern[2] = '(?U)(.*)(\b\d{1,2})(\. | )(\d{1,2})(, )(\d{4}|\d{2}\b)(.*\z)' ; d. m, y | d m, y $sReplace = "$6-$2-$4" Case 3 ; Big Endian $aPattern[1] = '(?U)(.*)(\b\d{4}|\b\d{2})([\./ \-]|\. )(\d{1,2})(\g3)(\d{1,2}\b)(.*\z)' ; Delimiter repeats $aPattern[2] = '(?U)(.*)(\b\d{4}|\b\d{2})(\. )(\d{1,2})( )(\d{1,2})(\..*\z)' ; y. m d. $sReplace = "$2-$4-$6" Case Else Return SetError(2) ; $Endianness must be a number between 1 and 3. EndSwitch Local $aEntries = StringSplit($sMultiline, $sLineBreak, 1) ; Whole delimiter string is used. Local $sDate, $aDateSplit, $aDateColumn[$aEntries[0] +1][2] ; A date sorting column is needed. For $i = 1 To $aEntries[0] $aDateColumn[$i][1] = $aEntries[$i] For $j = 1 To $aPattern[0] $sDate = StringRegExpReplace($aEntries[$i], $aPattern[$j], $sReplace, 1) ; Convert all to Big Endian If @extended Then ; Check replacements were made. $aDateSplit = StringSplit($sDate, "-", 2) $aDateSplit[0] = StringRight(StringLeft(@YEAR, 2) & $aDateSplit[0], 4) ; Accomodate 2 digit year If __ValidateDate($aDateSplit[2], $aDateSplit[1], $aDateSplit[0]) Then $aDateColumn[$i][0] = $aDateSplit[0] & _ ; Four digit year StringRight("0" & $aDateSplit[1], 2) & _ ; Accomodate single digit month StringRight("0" & $aDateSplit[2], 2) ; Accomodate single digit day ; Assuming either a single date or consistancy of format within a single line. ContinueLoop 2 ; See limitations EndIf EndIf Next $aDateColumn[$i][0] = "z" & StringRight("000000" & $i, 7) ; Prevent sorting invalid entries. Next _ArraySort($aDateColumn, 0, 1) Local $sSorted = "" For $i = 1 To $aEntries[0] -1 $sSorted &= $aDateColumn[$i][1] & $sLineBreak ; Append each entry in the new order. Next Return $sSorted & $aDateColumn[$aEntries[0]][1] ; Append the last entry without a line break EndFunc ;==> _SortByDateFuzzy Func __ValidateDate($sDay, $sMonth, $sYear) ; Year format must be ==> yyyy If $sMonth > 12 Or $sMonth = 0 Or $sDay = 0 Then Return False Switch Number($sMonth) Case 4, 6, 9, 11 If $sDay > 30 Then Return False Case 2 If (Mod($sYear, 4) And $sDay > 28) Or $sDay > 29 Then Return False Case Else If $sDay > 31 Then Return False EndSwitch Return True EndFunc ;==> __ValidateDate : Eighteen different delimiter sequences (used internationally) are supported with single digits for months or days along with year formats of two or four digits. The function actually supports 48 possible variants in each of the three types of endianness. See notes in the function header. Note: Some of the delimiter sequences may only occur when month names are used instead of numbers. They have low priority and are only included for reasons of compatibility with other date functions I have written. Month names are not supported at this present time. Example; Test_SortByDateFuzzy() Func Test_SortByDateFuzzy() Local $aTest[3][2] $aTest[0][0] = "Little Endian" $aTest[1][0] = "Middle Endian" $aTest[2][0] = "Big Endian" $aTest[0][1] = _ '14-8-2014,CSV DATA (UK)' & @CRLF & _ 'Chinese New Year: 31/1/14' & @CRLF & _ 'Fri 26-12.14 Boxing Day' & @CRLF & _ 'Chinese New Year 19 02 2015' & @CRLF & _ '13 8 2014,CSV DATA (Little Endian)' & @CRLF & _ '14-10.1066, Battle of Hastings' & @CRLF & _ 'Thu 25.12.14 Christmas Day' & @CRLF & _ '#ID,"14. 10 14",DETAILS' & @CRLF & _ 'Bach was born on 31/3/1685' & @CRLF & _ 'Christmas Eve 24. 12 2014' $aTest[1][1] = _ '8/14/2014,CSV DATA (Middle Endian)' & @CRLF & _ '#ID,"10 14, 14",DETAILS' & @CRLF & _ 'Boxing Day - Fri 12. 26, 2014' & @CRLF & _ 'JSB was born on 03. 31, 1685' & @CRLF & _ '12 25 14 Christmas Day' & @CRLF & _ '12 24 2014 Christmas Eve' & @CRLF & _ 'Thursday, 02. 19, 2015 Chinese New Year' & @CRLF & _ '8.13.2014,CSV DATA (US)' & @CRLF & _ '1 31, 2014 Chinese New Year' & @CRLF & _ 'Battle of Hastings 10.14.1066' $aTest[2][1] = _ '1066 10 14 - Battle of Hastings' & @CRLF & _ 'Chinese New Year 15 2 19' & @CRLF & _ '2014-08-13,CSV DATA 2' & @CRLF & _ '1685. 3. 31 - Bach was born' & @CRLF & _ 'Thu 2014. 12 25., Christmas Day' & @CRLF & _ ; ERROR 'Boxing Day - Fri 14-12-26' & @CRLF & _ '2014.8.14,CSV DATA 1' & @CRLF & _ '#ID,"14. 10 14.",DETAILS' & @CRLF & _ '14/12/24 Christmas Eve' & @CRLF & _ 'Friday, 2014-1-31 Chinese New Year' For $i = 0 To 2 ConsoleWrite($aTest[$i][0] & " ===>" & @CRLF) ConsoleWrite(_SortByDateFuzzy($aTest[$i][1], $i +1) & @CRLF) ConsoleWrite(@CRLF) Next EndFunc ;==> Test_SortByDateFuzzy() : Output: Little Endian ===> 14-10.1066, Battle of Hastings Bach was born on 31/3/1685 Chinese New Year: 31/1/14 13 8 2014,CSV DATA (Little Endian) 14-8-2014,CSV DATA (UK) #ID,"14. 10 14",DETAILS Christmas Eve 24. 12 2014 Thu 25.12.14 Christmas Day Fri 26-12.14 Boxing Day Chinese New Year 19 02 2015 Middle Endian ===> Battle of Hastings 10.14.1066 JSB was born on 03. 31, 1685 1 31, 2014 Chinese New Year 8.13.2014,CSV DATA (US) 8/14/2014,CSV DATA (Middle Endian) #ID,"10 14, 14",DETAILS 12 24 2014 Christmas Eve 12 25 14 Christmas Day Boxing Day - Fri 12. 26, 2014 Thursday, 02. 19, 2015 Chinese New Year Big Endian ===> 1066 10 14 - Battle of Hastings 1685. 3. 31 - Bach was born Friday, 2014-1-31 Chinese New Year 2014-08-13,CSV DATA 2 2014.8.14,CSV DATA 1 #ID,"14. 10 14.",DETAILS 14/12/24 Christmas Eve Thu 2014. 12 25., Christmas Day Boxing Day - Fri 14-12-26 Chinese New Year 15 2 19 ; It is not assumed that the data is of any particular format - only the endianness of dates is assumed to be consistent. This can never be an exact science.
  25. 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