Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Local time and System time
Message
 
To
17/12/1999 16:01:19
Alex Zhadanov
Computer Generated Solutions
New York City, New York, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00305457
Message ID:
00305602
Views:
28
>Hi folks.
>Who can tell me what difference between local time and system time.
>I have problem with timestamp field.
>If person in NY at 11 AM (Eastern time) create new record
>timestamp will be 11. And if person in LA create new record one hour
>later timestamp show 9 AM (local time in LA).
>I found 2 API SETLOCALTIME and SETSYSTEMTIME but i do not know
>how they can help me.
>Thank you in advance
>ALEX

In addition to what George Tasker said, you may want to store the UTC (system) time in future transactions, using API Function GetSystemTime().
*-- Return current UTC (system) datetime
Function GetUTCTime
  Declare GetSystemTime in win32api String@ systemtimebuffer
  Local dt, dtret
  dt=replicate(chr(0),16)
  GetSystemTime(@dt)
  *-- vfp6 specific datetime
  dtret=Datetime( Bitlshift(asc(Substr(dt,2,1)),8) + asc(substr(dt,1,1)), ;
                  Bitlshift(asc(Substr(dt,4,1)),8) + asc(substr(dt,3,1)), ;
                  Bitlshift(asc(Substr(dt,8,1)),8) + asc(substr(dt,7,1)), ;
                  Bitlshift(asc(Substr(dt,10,1)),8) + asc(substr(dt,9,1)), ;
                  Bitlshift(asc(Substr(dt,12,1)),8) + asc(substr(dt,11,1)), ;
                  Bitlshift(asc(Substr(dt,14,1)),8) + asc(substr(dt,13,1)))
  Return dtret
EndFunc
If you need to edit/display this information in Local (user) time, you can use the diference between datetimes:

tzdif = DateTime()-GetUTCTime()
*-- Edit/display this value
LocalTime = DateTimevariableInUTC + tzdif
*-- Store this value
BackToUTC = LocalTime - tzdif

Just an opinion... Not a fact.
Previous
Reply
Map
View

Click here to load this message in the networking platform