Solved

Converting local time to GMT

Posted on 1998-05-22
5
718 Views
Last Modified: 2013-12-03
I need to convert the local date and time to GMT.  I believe that GetSystemTime() will return the date/time in UTC format which is nearly the same as GMT.  I need to convert that into a string such as:

"Fri, 22 May 1998 14:06:39 -0700"

for pacific time.  More specifically, I need figure out the "-0700" value for a given PC.
0
Comment
Question by:dnavarro
  • 3
5 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1403539
There is probably a better way, but you could just use the difference between GetLocalTime and GetSystemTime.
0
 
LVL 11

Accepted Solution

by:
alexo earned 20 total points
ID: 1403540
You can call GetSystemTime() and GetLocalTime() and check the difference on the wHour and wMinute members.

--- or (better) ---

Use the GetTimeZoneInformation() function and check the Bias, StandardBias and DaylightBias members.

0
 
LVL 22

Expert Comment

by:nietod
ID: 1403541
Just beat me to it.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1403542
A good answer.  You wouldn't happen to have any sample code (C or VB) which does the calculation would you?

--Dave
0
 
LVL 1

Author Comment

by:dnavarro
ID: 1403543
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now