Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Easiest way to convert a time to GMT?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00365108
Message ID:
00365137
Vues:
14
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform