Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting time on specific time zones
Message
 
À
11/10/2000 01:46:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00427695
Message ID:
00427716
Vues:
15
Hi Michael,

I'd recommend storing all times in a standard (probably GMT) and letting users set their offset (most people know their offset from GMT in hours). People would need to remember to change their offset when daylight savings starts and finishes. I'd certainly recommend using the seconds to do the offset calcs.

You could get the local time with:
function GetLocalTime
lParameters ttServerTime, tnLocalOffset, tnServerOffset
local ltLocalTime
ltLocalTime = ttServerTime + (tnLocalOffset - tnServerOffset)*3600
return ltLocalTime
This assumes that you pass the time the message was posted (in the server's time zone), the user's offset from GMT and the Server's offset from GMT, both in Hours.

Cheers,

Andrew




>>Using the top frame as an example, each message ends with a TTOC(DateTime). You could store an hours difference for each user (e.g. Pacific Time = Montreal Time - 3hours).
>>
>>So, Al Doman would get TTOC(DateTime + (3600 * Hours Difference))
>
>Interesting, I never thought of using the seconds to obtain the new value.
>
>My approach was to use something like this:
>
>
>LOCAL lcTime,lnOffSet,ldDate,lnHour
>ldDate=CTOD(DTOC(tdTime))
>lnOffSet=gnTimeZone-8
>lnHour=HOUR(tdTime)+lnOffSet
>IF lnHour<0
>   lnHour=24-ABS(lnHour)
>   ldDate=ldDate-1
>ENDIF
>IF lnHour>23
>   lnHour=lnHour-24
>   ldDate=ldDate+1
>ENDIF
>
>
>where gnTimeZone is based on a number from 1 to 24 based on the list you see in the account setup for PUTM features on the time zone field.


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform