Followers 0

# Cannot figure out local to GMT time!

## 9 posts in this topic

#1 ·  Posted (edited)

I have tried every script I coul dfind related to GMT in these forums...and I just can;t get my head around the code!

I know I need this to figure out local timezone:

$a1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\" _ & RegRead ('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation','StandardName'),'Display')$a1=StringMid($a1,6,2)*_Iif(StringMid($a1,5,1)='+',1,-1)

and this should return the GMT time but it does not..

$sNewDate = _DateAdd( 'h',$a1, _NowCalc())
MsgBox( 4096, "", "Current GMT time : " & $sNewDate ) I want local time to UTC conversion. What am I missing? According to example given in Beta help file this code should show a change in minutes. It does not on my PC. Try and let me know. #include <Date.au3>$sNewDate = _DateAdd( 'n' ,5, _NowCalc() )
MsgBox( 4096, "", "Current time: " & _NowCalc()&" after adding 5 minutes " & $sNewDate) Works for me .... --------------------------- --------------------------- Current time: 2006/07/02 09:52:56 after adding 5 minutes 2006/07/02 09:57:56 --------------------------- OK --------------------------- Visit the SciTE4AutoIt3 Download page for the latest versions - Beta files Live for the present, Dream of the future, Learn from the past. #### Share this post ##### Link to post ##### Share on other sites #3 · Posted (edited) Hi, Not on mine though; "Current time: 2006/07/02 19:18:14 after adding 5 minutes 2006/07/02 19:18:14" Months years and days and weeks work... And Days and hours both add to days! And mins and secs not working! What is this?... Randallc Edited by randallc #### Share this post ##### Link to post ##### Share on other sites Hi, Not on mine though; "Current time: 2006/07/02 19:18:14 after adding 5 minutes 2006/07/02 19:18:14" Months years and days and weeks work... And Days and hours both add to days! And mins and secs not working! What is this?... Randallc What version AutoIt3 and UDF's are you using ? Visit the SciTE4AutoIt3 Download page for the latest versions - Beta files Live for the present, Dream of the future, Learn from the past. #### Share this post ##### Link to post ##### Share on other sites Hi, Not sure; does this help? >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "C:\Programs\SearchEngine\Tutorials\dateaddon.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams >Running AU3Check (1.54.1.1) params: from:C:\Program Files\AutoIt3\beta +>AU3Check ended.rc:0 >Running:(3.1.1.128):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Programs\SearchEngine\Tutorials\dateaddon.au3" Current time: 2006/07/02 22:05:02 after adding 5 minutes 2006/08/06 22:05:02 +>AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 6.324 Randallc #### Share this post ##### Link to post ##### Share on other sites Hi, Not sure; does this help? >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "C:\Programs\SearchEngine\Tutorials\dateaddon.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams >Running AU3Check (1.54.1.1) params: from:C:\Program Files\AutoIt3\beta +>AU3Check ended.rc:0 >Running:(3.1.1.128):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Programs\SearchEngine\Tutorials\dateaddon.au3" Current time: 2006/07/02 22:05:02 after adding 5 minutes 2006/08/06 22:05:02 +>AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 6.324 Randallc 3.1.1.127 was still OK, but 3.1.1.128 is giving this problem... Will investigate... Visit the SciTE4AutoIt3 Download page for the latest versions - Beta files Live for the present, Dream of the future, Learn from the past. #### Share this post ##### Link to post ##### Share on other sites #7 · Posted (edited) For some reason this test in _TicksToTime() now fails in the latest release: If StringIsInt($iTicks) ThenoÝ÷ Øp¢¹,~)ÞÂ§r§çm¡«­¢+Ù%9ÕµÈ ÀÌØí¥Q¥­Ì¤ÐìÀQ¡¸
Edited by JdeB

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

#8 ·  Posted (edited)

Glad I found a bug Fix works as intended. Thanks.

Buck

BTW, the issue with requiring the "> 0" is not exclusive to this function. It shows itself in most commands now.

Edited by Buckw1

##### Share on other sites

BTW, the issue with requiring the "> 0" is not exclusive to this function. It shows itself in most commands now.

Can you explain what you mean and which function is wrong ?

Live for the present,
Dream of the future,
Learn from the past.