WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: stevengraff on January 19, 2014, 07:50:50 AM

Title: How can I get current machine UTC offset?
Post by: stevengraff on January 19, 2014, 07:50:50 AM
I need to find out the difference in time of the current machine vs. GMT or UTc.

I bet this is not too hard... maybe it's in a registry entry? or an extender command? It is in the Windows Control Panel.

Thanks,
Steven
Title: Re: How can I get current machine UTC offset?
Post by: snowsnowsnow on January 19, 2014, 09:59:42 AM
Search the tech db.

It looks like:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/Time~-~Timer~and~Date~Functions/Samples~from~Users+Convert~UTC~Time.txt (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/Time~-~Timer~and~Date~Functions/Samples~from~Users+Convert~UTC~Time.txt)

has some helpful stuff.
Title: Re: How can I get current machine UTC offset?
Post by: stevengraff on January 19, 2014, 02:47:50 PM
Thanks a lot for that, snow.

I'm going with:

activebias = RegQueryDWORD( @REGMACHINE,'SYSTEM\CurrentControlSet\Control\TimeZoneInformation[ActiveTimeBias]')
machinegmtoffset = int ( ( activebias / 60 ) * ( -1 ) ) ;