Author Topic: UTC Time Conversion  (Read 32 times)


  • Newbie
  • *
  • Posts: 27
UTC Time Conversion
« on: June 19, 2018, 11:36:35 am »
Does anyone have an example of converting UTC to the current time of the computer?

For example extracting a windows event log using sample event log dumps found on winbatchs support site. The problem is, it's using UTC format.



  • Tech Support
  • *****
  • Posts: 2474
    • WinBatch
Re: UTC Time Conversion
« Reply #1 on: June 19, 2018, 01:40:40 pm »
It not the hard to do but the approach depends on the date format as it is present in your script.   For example, once you get the date into the WIL YYYY:MM:DD:HH:MM:SS format you can simply lookup the timezone bias in the registry and use the WIL time functions to add or subtract the indicated number of hours.   

There are multiple examples in the Tech Database the demonstrate this and other approaches.  Try searching on UTC or Timezone to find the one that best fits your specifics.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


  • Full Member
  • ***
  • Posts: 215
Re: UTC Time Conversion
« Reply #2 on: Today at 04:47:03 am »
Here's getting the offset from the registry:
Code: Winbatch
  s = "System\CurrentControlSet\control\TimeZoneInformation[ActiveTimeBias]"
  ActiveTimeBias = RegQueryDword(@REGMACHINE, s)
  GMTBiasHours = - (ActiveTimeBias / 60)
The mind is everything; What you think, you become.


  • Pundit
  • *****
  • Posts: 755
Re: UTC Time Conversion
« Reply #3 on: Today at 07:49:12 am »
Maybe I'm wrong but I thought Windows Log timestamps were converted to current computer time, or does the OP have more of an issue with converting the UTC timestamp string into something WB can handle?