Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Easiest way to convert a time to GMT?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00365108
Message ID:
00365137
Views:
15
>Does anyone know an easy way to convert a current local time to
>Greenwich mean time?

The following will retrieve GMT from the system:
declare integer GetSystemTime in kernel32 STRING@ lctimestr
lcsystem = replicate(chr(0),16)

lres = GetSystemTime(@lcsystem)
? datetime(WordToNum(substr(lcsystem,1,2)),WordToNum(substr(lcsystem,3,2)),;
	WordToNum(substr(lcsystem,7,2)),WordToNum(substr(lcsystem,9,2)),;
	WordToNum(substr(lcsystem,11,2)),WordToNum(substr(lcsystem,13,2)))

function WordToNum
lparameter tcWORD
local ln0,ln1
ln0=asc(subs(tcWORD,1,1))
ln1=asc(subs(tcWORD,2,1)) * (256)
return ln1 + ln0
It will automatically account for Daylight Savings Time.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform