Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UTC to Local Time
Message
 
To
12/02/2014 10:54:21
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP3
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01594152
Message ID:
01594168
Views:
46
Thanks for the info, Rick.

If you get time, I'd appreciate you taking the time to code this.

Thanks a bunch.

Tommy


>>Thanks for the info, Rick.
>>What I want to do is to take a UTC time that was saved in a field, convert it to the Local Time of this PC, and display it on the screen.
>>e.g.. let's say this field has the UTC time of 09/05/2013 06:46:44 PM
>>and the user is in North Carolina on this date of 02/12/2014 10:30:00 AM (EST) and wants to display the UTC field value.....
>>The Local Time for the UTC value would be 09/05/2013 02:46:44 PM (they were on Daylight Savings Time then so the Bias would be -4 hours)
>>Does MSDN have anything for that?
>
>Someone has surely written this in Visual FoxPro already.
>
>-----
>Win32 provides numerous functions to convert back-and-forth generically to any time zone:
>
>SystemTimeToTzSpecificLocalTime() in kernel32.dll.
>http://msdn.microsoft.com/en-us/library/windows/desktop/ms724949%28v=vs.85%29.aspx
>
>It's somewhat non-trivial to do it this way using Visual FoxPro. In C/C++ it's much easier. There are several steps involved. Populate the systemtime structures using manual population. You can use GetSystemTime() to populate an empty structure (SPACE(16), GetSystemTime(@lcTime)) to see what it should look like, with what values at what offset. Iterate through the string and extract every two bytes (FOR lnI = 1 TO 16 STEP 2 .... lcThisPart = SUBSTR(lcRawGetSystemTimeData, lnI, 2), and then convert to integer form. You can extract the binary 2-byte integer values from there using BINTOC(,2) and you'll need to store binary integer values back in there using CTOBIN(,2) and STUFF(), or a concatenation in the correct order. Populate the time zone structure using a blank structure (SPACE(88)) and GetTimeZoneInformation(@lcTimezone), and then it will convert using SystemTimeToTzSpecificLocalTime(). Then you extract out the converted form to obtain the new time.
>
>I would write this function for you, but I'm a little busy just now. Maybe later if you still need it.
>
>>Much appreciated !!!!
>>Tommy
Tommy Tillman A+ NetWork+ MCP
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform