Solved

Converting local time to GMT

Posted on 1998-05-22
5
722 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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