Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UTC time Conversion
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 2000 SP3
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01572478
Message ID:
01572638
Vues:
55
Wonderful!!! This is great!

Thanks!

>This is what I use:
>
>
>************************************************************************
>FUNCTION GetTimeZone
>*********************************
>***  Function: Returns the TimeZone offset from GMT including
>***            daylight savings. Result is returned in minutes.
>************************************************************************
>
>PUBLIC __TimeZone
>IF VARTYPE(__TimeZone) = "N"
>   RETURN __TimeZone
>ENDIF
>
>DECLARE integer GetTimeZoneInformation IN Win32API ;
>   STRING @ TimeZoneStruct
>   
>lcTZ = SPACE(256)
>
>lnDayLightSavings = GetTimeZoneInformation(@lcTZ)
>
>lnOffset = CharToBin(SUBSTR(lcTZ,1,4),.T.)
>
>*** Subtract an hour if daylight savings is active
>IF lnDaylightSavings = 2
>   lnOffset = lnOffset - 60
>ENDIF
>
>__TimeZone = lnOffset
>	
>RETURN lnOffSet
>
>
>************************************************************************
>*  GetUtcTime
>****************************************
>***  Function: Returns UTC time from local time
>***    Assume:
>***      Pass:
>***    Return:
>************************************************************************
>FUNCTION GetUtcTime(ltTime)
>IF EMPTY(ltTime)
>   ltTime = DATETIME()
>ENDIF
>   
>RETURN ltTime + (GetTimeZone() * 60)
>ENDFUNC
>*   GetUtcTime
>
>************************************************************************
>*  FromUtcTime
>****************************************
>***  Function: Returns local time from UTC Time
>***    Assume:
>***      Pass:
>***    Return:
>************************************************************************
>FUNCTION FromUtcTime(ltTime)
>RETURN ltTime - (GetTimeZone() * 60)
>ENDFUNC
>*   FromUtcTime
>
>
>
>+++ Rick ---
>
>>Hey Gang!
>>
>>Do you have any VFP code that can convert a DATETIME or DATE value into the
>>
>>UTC time (given the setup info in Windows itself for the workstation) ??
>>
>>Thanks!!
Tommy Tillman A+ NetWork+ MCP
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform