buymeapc Posted May 20, 2006 Share Posted May 20, 2006 I have the date and time in a variable, however, it is in UTC ticks. How can I get the exact date and time from this variable? Ex. $StartTime = "127927296000000000" ;Which is actually May 21, 2006 8:00PM How can I convert this?? Is there some reason I'm just not understanding this?? Link to comment Share on other sites More sharing options...
ChrisL Posted May 20, 2006 Share Posted May 20, 2006 (edited) What about Dim $mArray [13] $mArray[01]="January" $mArray[02]="February" $mArray[03]="March" $mArray[04]="April" $mArray[05]="May" $mArray[06]="June" $mArray[07]="July" $mArray[08]="August" $mArray[09]="September" $mArray[10]="October" $mArray[11]="November" $mArray[12]="December" $startTime = $mArray[@mon] &" " & @Mday & ", " & @year MsgBox (0,"Date",$startTime) Ohh hang on I left the time out. Does it need to be am/pm or is 24hour OK? Edited May 20, 2006 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
buymeapc Posted May 20, 2006 Author Share Posted May 20, 2006 I'm not sure I understand... How does this convert the UTC ticks into a readable date? Link to comment Share on other sites More sharing options...
ChrisL Posted May 20, 2006 Share Posted May 20, 2006 Sorry I thought you just wanted the date and time, which is below with the time with AM and PM but it sounds like this is not waht you want. You'd be better off posting your script Dim $mArray [13] $mArray[01]="January" $mArray[02]="February" $mArray[03]="March" $mArray[04]="April" $mArray[05]="May" $mArray[06]="June" $mArray[07]="July" $mArray[08]="August" $mArray[09]="September" $mArray[10]="October" $mArray[11]="November" $mArray[12]="December" If @hour > 12 then $time = @hour -12 & ":" & @min & " PM" Else $time = @hour & ":" & @min & " AM" Endif $startTime = $mArray[@mon] &" " & @Mday & ", " & @year & " " & $time MsgBox (0,"Date",$startTime) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted May 20, 2006 Share Posted May 20, 2006 is _TimeToTicks and _TicksToTime functions what you require, check out the beta help file [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Developers Jos Posted May 20, 2006 Developers Share Posted May 20, 2006 I have the date and time in a variable, however, it is in UTC ticks. How can I get the exact date and time from this variable? Ex. $StartTime = "127927296000000000" ;Which is actually May 21, 2006 8:00PM How can I convert this?? Is there some reason I'm just not understanding this?? Are you sure about: - The number of zero's in the UTC ticks value? - The result , should that be 8:00 PM ? #include<date.au3> $StartTime = "12792729600000" ; Remove 4 zero's $sNewDate = _DateAdd( 's',Number($StartTime)/1000, "1601/01/01 00:00:00") ConsoleWrite('@@ Debug(4) : $sNewDate = ' & $sNewDate & @lf & '>Error code: ' & @error & @lf) ;### Debug Console oÝ÷ Ùªº'«±©¨v)Ãj×»x§r[y«¢+ÙÕ¹}Ñ%ÍY±¥ ÀÌØíÍѤ(%1½°ÀÌØíÍÑAÉÑlÑt(%1½°ÀÌØíÍQ¥µAÉÑlÑt(%1½°ÀÌØí¥9ÕµåÌ($ÀÌØí¥9ÕµåÌôÅÕ½ÐìÌÄ°Èà°ÌÄ°ÌÀ°ÌÄ°ÌÀ°ÌÄ°ÌÄ°ÌÀ°ÌÄ°ÌÀ°ÌÄÅÕ½Ðì($ÀÌØí¥9ÕµåÌôMÑÉ¥¹MÁ±¥Ð ÀÌØí¥9ÕµåÌ°ÅÕ½Ðì°ÅÕ½Ðì¤($ìÍÁ±¥Ðѡѹѥµ¥¹Ñ¼ÉÉåÌ(%}ÑQ¥µMÁ±¥Ð ÀÌØíÍÑ°ÀÌØíÍÑAÉаÀÌØíÍQ¥µAÉФ(%%ÀÌØíÍÑAÉÑlÁt±ÐìÐìÌQ¡¸($%IÑÕɸ À¤(%¹%($ìÙÉ¥äÙ±¥¥¹ÁÕÐÑÙ±ÕÌ(%%}Ñ%Í1ÁeÈ ÀÌØíÍÑAÉÑlÅt¤Q¡¸ÀÌØí¥9ÕµåÍlÉtôÈä(%%ÀÌØíÍÑAÉÑlÅt±ÐìÄÀÀÀ=ÈÀÌØíÍÑAÉÑlÅtÐìÈäääQ¡¸IÑÕɸ À¤ì±Ðìôôô ¡¹Ñ¡¥Ì±¥¹¥¸Ñ¹ÔÌ(%%ÀÌØíÍÑAÉÑlÉt±ÐìÄ=ÈÀÌØíÍÑAÉÑlÉtÐìÄÈQ¡¸IÑÕɸ À¤(%%ÀÌØíÍÑAÉÑlÍt±ÐìÄ=ÈÀÌØíÍÑAÉÑlÍtÐìÀÌØí¥9ÕµåÍlÀÌØíÍÑAÉÑlÉutQ¡¸IÑÕɸ À¤($($ìÙÉ¥äÙ±¥¥¹ÁÕÐQ¥µÙ±ÕÌ(%%ÀÌØíÍQ¥µAÉÑlÁt±ÐìÄQ¡¸IÑÕɸ Ĥì9¼Ñ¥µÍÁ¥¥Í¼ÑµÕÍнÉÉÐ(%%ÀÌØíÍQ¥µAÉÑlÁt±ÐìÈQ¡¸IÑÕɸ À¤ì¹Ð±ÍÐ! é54Ý¡¸Í½µÑ¡¥¹¥ÌÍÁ¥¥(%%ÀÌØíÍQ¥µAÉÑlÅt±ÐìÀ=ÈÀÌØíÍQ¥µAÉÑlÅtÐìÈÌQ¡¸IÑÕɸ À¤(%%ÀÌØíÍQ¥µAÉÑlÉt±ÐìÀ=ÈÀÌØíÍQ¥µAÉÑlÉtÐìÔäQ¡¸IÑÕɸ À¤(%%ÀÌØíÍQ¥µAÉÑlÍt±ÐìÀ=ÈÀÌØíÍQ¥µAÉÑlÍtÐìÔäQ¡¸IÑÕɸ À¤($ìݽСÉͼѽѥµµÕÍн½(%IÑÕɸ Ĥ)¹Õ¹ìôôÐí}Ñ%ÍY±¥ SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
buymeapc Posted May 20, 2006 Author Share Posted May 20, 2006 (edited) Are you sure about:- The number of zero's in the UTC ticks value?- The result , should that be 8:00 PM ?I am sure about the trailing zero's, however, I have seen people divide this number by 10,000 to remove them before working with the number.I am pretty sure about the time being 8PM.If I make that change to the Date.au3 file, then the above code you posted will work?is _TimeToTicks and _TicksToTime functions what you require, check out the beta help fileUnfortunately, these functions only handle hours, minutes and seconds; I need to decipher days and the month as well. Edited May 20, 2006 by buymeapc Link to comment Share on other sites More sharing options...
Valuater Posted May 20, 2006 Share Posted May 20, 2006 Unfortunately, these functions only handle hours, minutes and seconds; I need to decipher days and the month as well. maybe $file = "XPClean-Menu.exe" #include<date.au3> $t = FileGetTime($file, 1) If Not @error Then $startdate = $t[0] & "/" & $t[1] & "/" & $t[2] & " " & $t[3] & ":" & $t[4] & ":" & $t[5] If _DateDiff("D", $startdate, _NowCalc()) > 30 Then MsgBox(0, "*XPClean Menu*", "Your registration period has expired.") Exit EndIf Else $ans = _DateDiff("D", $startdate, _NowCalc()) MsgBox(0, $ans & " days", _NowCalc() & @CRLF & $startdate) EndIf 8) Link to comment Share on other sites More sharing options...
buymeapc Posted May 20, 2006 Author Share Posted May 20, 2006 Sorry, Valuater, My date and time is in UTC format and I'm trying to get it into YYYYMMDDHHMMSS format. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 20, 2006 Developers Share Posted May 20, 2006 (edited) If I make that change to the Date.au3 file, then the above code you posted will work? Unfortunately, these functions only handle hours, minutes and seconds; I need to decipher days and the month as well. I get this after making the change: "2006/05/22 00:00:00" . Could that be in GMT which still need to be translated to your own timezone? UTC was initiated at the start of 1961. The TAI instant 1961-01-01T00:00:01.422818 exactly was identified as UTC instant 1961-01-01T00:00:00.000000 exactly, and UTC ticked exactly one second for every 1.000000015 s of TAI. Time steps and rate changes occurred every few months thereafter. These "elastic seconds" and small jumps (most commonly of 0.1 TAI seconds) were intended to permit a very close approximation of UT2, within around 0.1 s. Edited May 20, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
buymeapc Posted May 20, 2006 Author Share Posted May 20, 2006 Actually, that looks correct!! UTC time is EST +4 So, if it's 8PM in CT (where I am) then it's 12AM UTC I think I'll make a copy of Date.au3 before making the change. Let me see if I can replicate what you guys have done. Link to comment Share on other sites More sharing options...
buymeapc Posted May 20, 2006 Author Share Posted May 20, 2006 (edited) Wow! It worked!I have been banging my head against a wall for a week on this one...thank you very, very much!! Edited May 20, 2006 by buymeapc Link to comment Share on other sites More sharing options...
Developers Jos Posted May 20, 2006 Developers Share Posted May 20, 2006 Wow! It worked!I have been banging my head against a wall for a week on this one...thank you very, very much!! I will make the same change in the official Date.au3 .. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
buymeapc Posted May 22, 2006 Author Share Posted May 22, 2006 I've helped in a part of AutoIt history. I feel honored. 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