Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP Command that will provide the timezone?
Message
 
 
À
20/04/2007 14:09:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01218419
Message ID:
01218568
Vues:
16
>Looking for a VFP command/function that will return the current Time Zone. If it doesn't exist I'll just have to create one using the win32 api. I'm sure I'm not the first to ask about this.
>
>Thanks,
>Bruce
>Napa, CA

If you have .NetExtender you can use VFP and .Net Framework this way:
CLEAR
oTimeZone = clrGetTypeReference("System::TimeZone","Mscorlib.dll")
oLocalZone = oTimeZone.CurrentTimeZone

? "Standard Time name:",oLocalZone.Standardname
? "Daylight Saving Time name:",oLocalZone.DayLightName
?
? "Current date and time:",DATETIME()
? "Daylight saving time?",oLocalZone.IsDaylightSavingTime(DATETIME())
UTC = oLocalZone.ToUniversalTime(DATETIME())
? "Coordinated Universal Time:",UTC.ToString
UTCOffset = oLocalZone.GetUtcOffSet(DATETIME())
? "UTC offset:",UTCOffset.ToString
DayLightTime = oLocalZone.GetDaylightChanges(YEAR(DATE()))
? "Daylight Savings Time period:",DayLightTime.Start.ToString,"-",dayLightTime.End.ToString,daylighttime.Delta.ToString
and get output like:

Standard Time Name: Central Standard Time
Daylight Savings Time name: Central Daylight Time

Current date and time: 04/20/07 11:10:51 PM
Daylight saving time? .T.
Coordinated Universal Time: 4/21/2007 4:10:51 AM
UTC offset: -05:00:00
Daylight Savings Time Period: 3/11/2007 2:00:00 AM - 11/4/2007 2:00:00 AM 01:00:00
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform