Search the Community

Showing results for tags 'time'.



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 31 results

  1. After Several Minutes searching the forums for a simple solution to calculating for the Unix Time, as required for another project I am working on, I was astonished to not find one clean and universal solution. After looking over the helpfile, I noticed one simple solution given in the example with _DateDiff(). However it did not account for my current timezone or daylight savings time. Without further ado... This is my example of Calculating for a current Unix Time stamp or seconds since Jan, 1st, 1970 00:00:00 GMT. This function will account for your timezone as well as for daylight savings time. Update: v0.3 -Added Function to revert a Unix Time stamp into Date form. -Added parameter to original _GetUnixTime() allowing for a custom date since Jan 1st 1970 to be passed and converted to Unix Time. #include <Date.au3> #include <Array.au3> #include <Constants.au3> Local $iUnixTime1 = _GetUnixTime() MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Seconds Since Jan, 1st, 1970 00:00:00 GMT" & @CRLF & $iUnixTime1) Local $sUnixDate1 = _GetDate_fromUnixTime($iUnixTime1) MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Get Date from Unix Timestamp in Local Time" & @CRLF & $sUnixDate1) $sUnixDate1 = _GetDate_fromUnixTime($iUnixTime1, False) MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Get Date from Unix Timestamp with $iReturnLocal = False which returns UTC Time" & @CRLF & $sUnixDate1) Local $iUnixTime2 = _GetUnixTime('2013/01/01 00:00:00') MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Seconds since 2013/01/01 00:00:00" & @CRLF & $iUnixTime2) ; Get timestamp for input datetime (or current datetime). Func _GetUnixTime($sDate = 0);Date Format: 2013/01/01 00:00:00 ~ Year/Mo/Da Hr:Mi:Se Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $utcTime = "" If Not $sDate Then $sDate = _NowCalc() If Int(StringLeft($sDate, 4)) < 1970 Then Return "" If $aSysTimeInfo[0] = 2 Then ; if daylight saving time is active $utcTime = _DateAdd('n', $aSysTimeInfo[1] + $aSysTimeInfo[7], $sDate) ; account for time zone and daylight saving time Else $utcTime = _DateAdd('n', $aSysTimeInfo[1], $sDate) ; account for time zone EndIf Return _DateDiff('s', "1970/01/01 00:00:00", $utcTime) EndFunc ;==>_GetUnixTime ;$blTrim: Year in short format and no seconds. Func _GetDate_fromUnixTime($iUnixTime, $iReturnLocal = True) Local $aRet = 0, $aDate = 0 Local $aMonthNumberAbbrev[13] = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] Local $timeAdj = 0 If Not $iReturnLocal Then Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $timeAdj = $aSysTimeInfo[1] * 60 If $aSysTimeInfo[0] = 2 Then $timeAdj += $aSysTimeInfo[7] * 60 EndIf $aRet = DllCall("msvcrt.dll", "str:cdecl", "ctime", "int*", $iUnixTime + $timeAdj ) If @error Or Not $aRet[0] Then Return "" $aDate = StringSplit(StringTrimRight($aRet[0], 1), " ", 2) Return $aDate[4] & "/" & StringFormat("%.2d", _ArraySearch($aMonthNumberAbbrev, $aDate[1])) & "/" & $aDate[2] & " " & $aDate[3] EndFunc ;==>_GetUnixDate Enjoy! Realm Update: >Added some functionality and a suggestion from FireFox
  2. Hi, I created a gui with date field but formatted as time in HH:mm. It always shows "now-time". Even if I try to set it with GUICtrlSetData. #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT) ; to select a specific default format Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUICtrlSetData($idDate, "00:00") ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example How can I set the time field with another time and how can this field be set blank? Regards, Conrad
  3. Hi guys I need to get time of different city, London, Jerusalem, Mosca and many others. My starting script: #include <Date.au3> Local $iUTC, $iHour, $iMinute, $iSecond $iUTC = _Date_Time_GetSystemTime() $iHour = DllStructGetData($iUTC, "Hour") $iMinute = DllStructGetData($iUTC, "Minute") $iSecond = DllStructGetData($iUTC, "Second") ConsoleWrite("+UTC: " & $iHour & ":" & $iMinute & ":" & $iSecond & @CRLF) My idea was start from UTC time and then add-remove hours. But what about the DST, Daylight Savings Time? How i can know if in a country is active or not? There is an API? Example with _Date_Time_GetTimeZoneInformation it will give the current time zone settings and not for other time zone. I don't have understand if is possible or not On the help i have found SystemTimeToTzSpecificLocalTime but i don't have understand how to use for other time zone... Thanks
  4. 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
  5. Hi, I wanted to use _GetLogonTime() by guinness (https://www.autoitscript.com/forum/topic/19370-autoit-wrappers/?do=findComment&comment=942069). #include <Date.au3> #include <Array.au3> ConsoleWrite(_GetLogonTime() & @LF) Func _GetLogonTime($sUserName = @UserName, $sComputerName = @ComputerName) ; Idea by trancexx: http://www.autoitscript.com/forum/topic/113611-if-isadmin-not-detected-as-admin/ Local $aRet = DllCall("netapi32.dll", "long", "NetUserGetInfo", "wstr", $sComputerName, "wstr", $sUserName, "dword", 11, "ptr*", 0) _ArrayDisplay($aRet) If @error Or $aRet[0] Then Return SetError(1, 0, False) Local $sHours = DllStructGetData(DllStructCreate("ptr;ptr;ptr;ptr;dword;dword;dword;ptr;ptr;dword;dword;dword;dword;ptr;dword;ptr;dword;dword;byte;dword", $aRet[4]), 18) DllCall("netapi32.dll", "long", "NetApiBufferFree", "ptr", $aRet[4]) Return _DateAdd("h", "-" & $sHours, _NowCalc()) EndFunc ;==>_GetLogonTime It always returns false. I displayed $aRet: [0]|2221 [1]|mycomputer [2]|myuser [3]|11 [4]|0x0000000000000000 $aRet[4] shouldn't be 0x0000000000000000 right? Any help? Regards, Conrad
  6. Hello. I have 5 DCs, and I need to create a scheduled task to run a script that will test the authentication time for each one of them, once every minute. (Then I'll use it within a log analyser to create graphics). I came up with a script using the great AD UDF (by water). First I tried using "for" and an array, but something was messing up the results, then I went for the dumb old fashioned way: #Include <ad.au3> #include <MsgBoxConstants.au3> Global $AdTestTime = "" Global $Timer1, $Timer2, $Timer3, $Timer4, $Timer5 = "" Global $sAD1 = "MYSERVER109" Global $sAD2 = "MYSERVER110" Global $sAD3 = "MYSERVER111" Global $sAD4 = "MYSERVER112" Global $sAD5 = "MYSERVER113" $Timer1 = Timerinit() _AD_Open("", "", $sAD1) _AD_Close() Local $fDiff1 = TimerDiff($Timer1) $Timer2 = Timerinit() _AD_Open("", "", $sAD2) _AD_Close() Local $fDiff2 = TimerDiff($Timer2) $Timer3 = Timerinit() _AD_Open("", "", $sAD3) _AD_Close() Local $fDiff3 = TimerDiff($Timer3) $Timer4 = Timerinit() _AD_Open("", "", $sAD4) _AD_Close() Local $fDiff4 = TimerDiff($Timer4) $Timer5 = Timerinit() _AD_Open("", "", $sAD5) _AD_Close() Local $fDiff5 = TimerDiff($Timer5) MsgBox(0,"", "MYSERVER109=" & $fDiff1) MsgBox(0,"", "MYSERVER110=" & $fDiff2) MsgBox(0,"", "MYSERVER111=" & $fDiff3) MsgBox(0,"", "MYSERVER112=" & $fDiff4) MsgBox(0,"", "MYSERVER113=" & $fDiff5) Still, something is off here. The first AD to be tested is always the slowest one, by far, like 20 times slower. Then I started to suspect that the first one starts the "negotiation", and the following ones ride the gravy train. If I repeat the first code twice, All servers seem to have a similar result. $Timer1 = Timerinit() _AD_Open("", "", $sAD1) _AD_Close() Local $fDiff1 = TimerDiff($Timer1) $Timer1 = Timerinit() _AD_Open("", "", $sAD1) _AD_Close() Local $fDiff1 = TimerDiff($Timer1) $Timer2.... Am I right? Also, is there a better way to test the authentication time? Thanks for the help. - Dave
  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 there all - how can I find out if $now is between 2pm to 2am and if so run a function - any help will be most welcomed!
  10. Hey I've these two functions to do a base64 conversation , Is there any way to compare the exact speed of both of them ? Func _Base64Encode($input) $input = Binary($input) Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]") DllStructSetData($struct, 1, $input) Local $strc = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error encoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Encode Func _Base64Encode($sData) Local $oXml = ObjCreate("Msxml2.DOMDocument") If Not IsObj($oXml) Then SetError(1, 1, 0) EndIf Local $oElement = $oXml.createElement("b64") If Not IsObj($oElement) Then SetError(2, 2, 0) EndIf $oElement.dataType = "bin.base64" $oElement.nodeTypedValue = Binary($sData) Local $sReturn = $oElement.Text If StringLen($sReturn) = 0 Then SetError(3, 3, 0) EndIf Return $sReturn EndFunc ;==>_Base64Encode
  11. All I'm after is a script that will continuously check the time, and if a process starts before 5:00, then it will be killed straight away, if its after 5:00, then it is allowed to run. But on weekends the process is allowed to run at any time. A script that I could just modify to my needs would be nice, but if someone could point me to the Help File section that will do what I need, that would be better.
  12. I got a while loop, if something happens the while loop shall stop, but shall continue after a specific time like lets say 10 minutes, how would you manage this.
  13. I'm using ftp functions but the modification time always have 0 seconds. Is it how it should work? I checked in FileZilla and it returns seconds.
  14. Hi all, I am try to find a way of getting the time in any other country. I have been searching the autoit forum for a solution, searching 'Date' UDF & looking at scripts using NTP servers however have hit a wall on where to start scripting, anyone point me in the right direction here? Thanks Chris
  15. #include <IE.au3> Local $oIE Sleep Local $oFrame Local $oDiv For If EndIf NextThis is my code and i'd like to repeat the action of clicking a button by its classname every 3 seconds.... i get this done only once and after the first time it doesn't repeat itself. Should i insert a continue loop, and if so how can i relate it to my code because i haven't found nothing in help file or example scripts....
  16. 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!!!
  17. Hi all and thank you for your help. I have been working on a log-out for a gui and some times this code will not work. How do I get past AM and PM? Edit 1 Ok i think I have it. Thanks Valuater https://www.autoitscript.com/wiki/Snippets_(_Time_%26_Date_) Edit 2 Still not there... Please help. #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Time Machine", 252, 117, 2421, 445) GUISetBkColor(0xA6CAF0) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Checkbox1 = GUICtrlCreateCheckbox("Exit GUI ", 24, 24, 105, 25) $Date1 = GUICtrlCreateDate(" ", 136, 24, 98, 24, $DTS_TIMEFORMAT) $Label1 = GUICtrlCreateLabel("00:00:00 ", 136, 72, 93, 20) GUIctrlSetData($Label1, _Time()) $Button1 = GUICtrlCreateButton("Start", 24, 72, 75, 25) GUICtrlSetOnEvent($Button1, "_Func_1") $Button2 = GUICtrlCreateButton("Stop", 24, 72, 75, 25) GUICtrlSetOnEvent($Button2, "_Func_2") GUICtrlSetState($Button2, $GUI_HIDE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_COMMAND_STOP") Global $stop = 0; set exitloop flag While 1 Sleep(100) WEnd Func _Func_1() GUICtrlSetState($Button1, $GUI_HIDE); Hide and show start and stop GUICtrlSetState($Button2, $GUI_SHOW) While 1 Sleep(1000) If $stop <> 0 Then ; set exitloop Return EndIf If _IsChecked($Checkbox1) Then; check for checkbox to exit Local $set = GUICtrlRead($Date1) Local $tm = _Time() If $set < $tm Then Exit EndIf EndIf GUICtrlSetData($Label1, $tm ); set lable time WEnd EndFunc ;==>_Func_1 Func _Time() Local $hour = @HOUR, $AMPM = "AM" If $hour > 11 Then $AMPM = "PM" If $hour = 0 Then $hour = 12 If $hour > 12 Then $hour -= 12 Return $hour & ":" & @MIN & ":" & @SEC & " " & $AMPM EndFunc ;==>_Time Func _Func_2();====================================== Set button 1 to show and hide button 2 GUICtrlSetState($Button2, $GUI_HIDE) GUICtrlSetState($Button1, $GUI_SHOW) $stop = 0 EndFunc ;==>_Func_2 Func _IsChecked($idControlID);===================== Look for Checkbox ====================== Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func _COMMAND_STOP($hWnd, $Msg, $wParam, $lParam); Set $Interrupt to stop loop If BitAND($wParam, 0x0000FFFF) = $Button2 Then $stop = 1 Return $GUI_RUNDEFMSG EndFunc ;==> _COMMAND_STOP Func _Exit() Exit EndFunc ;==>_Exit  
  18. i can find how to do the opposite but i want to take 00:00:22.17 and put into milliseconds which would be 22017 ?? or no seems like it should be super simple but not finding it anywhere. i get a bunch of audio files with that time stamp and i and i want to to convert to milliseconds thanks!
  19. Hi All, I've run into an issue in one of my scripts using the GUICtrlCreateDate function with the $DTS_TIMEFORMAT flag. Basically, after the creation of the Date tool, I seem to be unable to set the data in the box; And after reading the function reference for GuiCtrlSetData, This does seem to be something that's supported... So i'm a little lost as to where exactly i'm going wrong. I've created a quick test script, and still can't get the two functions to work harmoniously: local $GUI = GuiCreate("",100,40) local $testDate = GUICtrlCreateDate("",15,10,70,20,9,-1) local $test = GUIctrlSetData(-1,"09:00:00") ConsoleWrite($test & @CR) GUIsetState(@SW_SHOW) While 1 switch GUIgetMsg() Case -3 Exit EndSwitch WEnd Theoretically, the date input should show 09:00:00, But the GUIctrlSetData seems to be failing (returning 0). I've checked the format of the Date input by using GUIctrlRead, and have adhered to that format in the test above, but it still seems to be failing. Any Ideas? Any help is greatly appreciated! Many Thanks Javi
  20. Hi all! I am perplexed by something that should be simple. I am trying to make a small timer which will become part of a larger script, but I'm stuck on comparing the 2 times.. When you run the script, you hit OK on a message box, that's when the current system time and day of the year is saved to a variable.. when you hit OK again, the timer is stopped and the date and time are compared. I'm not using Timerinit() because I want the exact system time the timer started, and the exact system time the timer stopped. Then the time is compared and you get the difference. This is easy as long as I am subtracting 10 seconds from 15 seconds, but what if the start timeer got second: 45 and the top timer got second: 12? I'm sure this is cakewalk for anyone that got higher than a C in math, but I didnt. Can anyone shed some light on this for a simpleton like myself? Msgbox(0,"START","Click to start timer") $a = timestamp() Msgbox(0,"START","Click to stop timer") $b = timestamp() compare($a,$b) Func timestamp() Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort') DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime)) $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8)) $stSystemTime = 0 return @YDay & ':' & @Hour & ':' & @Min & ':' & @Sec & ':' & $sMilliSeconds EndFunc Func compare($start,$stop) $Comp_a = StringSplit($start,":",2) $Comp_b = StringSplit($stop,":",2) $DayDif = $comp_b[0] - $comp_a[0] $HourDif = $comp_b[1] - $comp_a[1] $MinDif = $comp_b[2] - $comp_a[2] $SecDif = $comp_b[3] - $comp_a[3] If $comp_b[4] > $comp_a[4] then $MSecDif = $comp_b[4] - $comp_a[4] else $MSecDif = $comp_a[4] - $comp_b[4] endif Msgbox(0,"hey you, yeah you!", "Elapse Time:" & @CRLF & "Days: " & $DayDif & @CRLF & "Hours: " & $HourDif & @CRLF & "Minutes: " & $MinDif & @CRLF & "Seconds: " & $SecDif & @CRLF & "Miliseconds: " & $MSecDif ) endfunc Thanks in advance!! EDIT: Would this logic work? ;example $start = 45 $stop = 12 $val1 = $Start - 60 ; val1 becomes 15 $Mydiff = $stop + $val1
  21. 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
  22. Hey guys... not a vital issue or anything, but I've setup the format of date and time in a user input field (code included below), but the output is off on the second field and I can't figure where it's getting it from.... the code displayed is the only place in the program that modifies these fields: $StartDate = GUICtrlCreateDate(@Year&"/"&@MON&"/"&@MDAY&" "&@HOUR&":00", 8, 112, 138, 21) ; to select a specific default format $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "yyyy/MM/dd HH:mm" GUICtrlSendMsg($StartDate, $DTM_SETFORMAT_, 0, $style) $EndDate = GUICtrlCreateDate(@Year&"/"&@MON&"/"&@MDAY+1&" "&@HOUR&":00", 8, 152, 138, 21) $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "yyyy/MM/dd HH:mm" GUICtrlSendMsg($EndDate, $DTM_SETFORMAT_, 0, $style) The outputs are: Startdate: 2014/04/04 17:00 (good so far) EndDate: 2014/04/05 07:25 (Where did 07:25 come from? FYI 25 is the current Minute time of the test, but the 07Hour is not. Current hour is 17:00) Both fields have almost exactly the same code and syntax with endDate being incrimented by 1. Nowhere else in my script am I making any modifications to either field, just read. Thanks for your help
  23. hello everybody, i need your help please it a simple script , i want to run a message box in the next day from this day. example: - i took the current day as refernce - add one day to it -make a condition to see if it is the new day - if it is true run a message box this is my code nee some help thank you in advance there is one small problem which is the CPU when i run my code it is 100/100 need to low it
  24. I searched for this oddity for a while but found no results. If I missed it, my apologies. I have an app that I am building that will eventually search a SQL database for results within a specified range of time. To collect the range of time required but the user, I have 2 fields I created, one for start and the other for end times. They are formatted "yyyy/MM/dd HH:MM:ss" for entry. The fields are created with this: $dpStartDate = GUICtrlCreateDate(_NowCalc(), 112, 88, 146, 24) $dpEndDate = GUICtrlCreateDate(_NowCalc(), 416, 88, 146, 24) I am setting the format of the fields with this code: $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "yyyy/MM/dd hh:mm:ss" GUICtrlSendMsg($dpStartDate, $DTM_SETFORMAT_, 0, $style) GUICtrlSendMsg($dpEndDate, $DTM_SETFORMAT_, 0, $style) What I am attempting to do is when the start field is updated, compare it with the end time field. If the end time is less than the start time, make both fields match. When I attempt to do so with the function below, The end time date is copied correctly but the time (hour) is reset to 1, no matter the time entered. Am I going about updating the field incorrectly? As an example, I set the date in the start field to "2013/08/23 11:47:38", the end time field gets set to "2013/08/23 01:00:00" Func dpStartDateChange() Local $stDT = GUICtrlRead($dpStartDate), $edDT = GUICtrlRead($dpEndDate) If $edDT < $stDT Then MsgBox(0,"Change Needed","End Time: "&$edDT&@CRLF&"Start Time: "&$stDT) ;Shows correct time GUICtrlSetData($dpEndDate,$stDT) EndIf EndFunc There is no code for SQL in place yet. I am working on some of the GUI logic for now. Let me know if there is enough code here or you need more.
  25. I am trying to take 2 times and determine the difference, example: Time one 13:43:24,424 Time two 13:44:35:424 Time that has passed is 0:1:11,000 how can i get the time that has passed?