Solved

Converting local time to GMT

Posted on 1998-05-22
5
724 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WPF MainWindow update textbox from another class... 6 176
Clean Uninstall of VS Professional 2015 5 60
Need more details 5 185
VS2015 Redefinition errors 4 91
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…

730 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