Converting GMT to local time 
Author Message
 Converting GMT to local time

I have been trying to convert a date/time value (e.g. 2/14/98 03:14:22) from
GMT to local time.

I have played with the mktime, localtime, gmtime etc functions. Although I
can convert local time to GMT, I can't seem to go the other way using the C
runtime library functions.

I have a file containing a list of transactions that are all timestamped
with GMT values. As I read the file I would like to convert each timestamp
value to local time, taking into account whether daylight savings time was
in effect for the date being converted.

Does anyone know of an API function or some other method I could use to do
the conversion?

Thanks in advance for any assistance.

Steve Smith



Thu, 17 Aug 2000 03:00:00 GMT  
 Converting GMT to local time

Quote:

>I have been trying to convert a date/time value (e.g. 2/14/98 03:14:22)
from
>GMT to local time [taking DST into account].

For time zone functions, including accurate information, you might want to
look at the files
ftp://elsie.nci.nih.gov/pub/tzcode1998c.tar.gz
and
ftp://elsie.nci.nih.gov/pub/tzcode1998c.tar.gz

Regards,

Eric Ulevik



Fri, 18 Aug 2000 03:00:00 GMT  
 Converting GMT to local time

On Sun, 1 Mar 1998 11:21:32 -0800, "Steve Smith"

Quote:

>I have been trying to convert a date/time value (e.g. 2/14/98 03:14:22) from
>GMT to local time.

>I have played with the mktime, localtime, gmtime etc functions. Although I
>can convert local time to GMT, I can't seem to go the other way using the C
>runtime library functions.

Right, mktime receives a struct tm that's local time, so you're out of
luck there, unless you feel like playing with the non-standard
_tzset() function and TZ environment variable. It seems you could
force mktime to interpret its argument as UTC that way. Also, have a
look at mktime.c, and _mkgmtime. The function's there, it just isn't
published.

Quote:
>I have a file containing a list of transactions that are all timestamped
>with GMT values. As I read the file I would like to convert each timestamp
>value to local time, taking into account whether daylight savings time was
>in effect for the date being converted.

>Does anyone know of an API function or some other method I could use to do
>the conversion?

Also look at the Win32 SystemTime and FileTime functions:

 SystemTimeToTzSpecificLocalTime (NT only)
 SystemTimeToFileTime
 FileTimeToLocalFileTime

"System time" is defined to be UTC, so these should do the trick.

--
Doug Harrison



Fri, 18 Aug 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Q: How to convert GMT to local time?

2. How to convert local time to gmt using a local variable time zone per process/thread

3. Convert local time to gmt time without using TimeZone Env variable

4. How to convert GMT time to local time?

5. GMT time and Local time ?

6. How to convert local time with specific time zone to UTC time in Win32 API

7. GMT to local time conv

8. Converting UTC time to local time

9. converting from Local Time to UTC time...

10. howDoI convert a time from GMT to PST

11. Converting VARIANT DATE to GreenwichMean Time (GMT) or LocalTime

12. time confusion. I want time now GMT

 

 
Powered by phpBB® Forum Software