Solved

Converting local time to GMT

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

16 Experts available now in Live!

Get 1:1 Help Now