Converting VARIANT DATE to GreenwichMean Time (GMT) or LocalTime 
Author Message
 Converting VARIANT DATE to GreenwichMean Time (GMT) or LocalTime

I have an automation datatype, DATE, that contains local time and I must
convert it to GreenwichMeanTime(GMT) and then place it back into a DATE
variable.  I also have a DATE that contains GMT and must convert it to local
time and place it back into a DATE variable.

I can not use MFC nor gmtime() or localtime() because their base date is
Jan. 1, 1970.  I need to cover dates back to 1800's.

Any ideas?
Thanks in advance,
W. Chamberlain



Mon, 19 Apr 2004 23:33:43 GMT  
 Converting VARIANT DATE to GreenwichMean Time (GMT) or LocalTime
From Local to UTC:
VariantTimeToSystemTime then SystemTimeToFileTime then
LocalFileTimeToFileTime then FileTimeToSystemTime then
SystemTimeToVariantTime

From UTC to Local is left as an exercise for the reader (hint: see
FileTimeToLocalFileTime).

SYSTEMTIME can represent any date AD, FILETIME works for dates after January
1, 1601, DATE starts at December 31, 1899.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat, and
wrong." H.L. Mencken


Quote:
> I have an automation datatype, DATE, that contains local time and I must
> convert it to GreenwichMeanTime(GMT) and then place it back into a DATE
> variable.  I also have a DATE that contains GMT and must convert it to
local
> time and place it back into a DATE variable.

> I can not use MFC nor gmtime() or localtime() because their base date is
> Jan. 1, 1970.  I need to cover dates back to 1800's.

> Any ideas?
> Thanks in advance,
> W. Chamberlain




Tue, 20 Apr 2004 00:06:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Want to get localtime from GMT 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. howDoI convert a time from GMT to PST

6. Q: Need algorithm to convert date-time to Julian date

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

8. Converting GMT to local time

9. localtime() returns GMT with POSIX(ON)

10. Finding offset of localtime() from GMT

11. Converting VARIANT date to string representation ?

12. time confusion. I want time now GMT

 

 
Powered by phpBB® Forum Software