Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting DateTime variable to GMT or UTC
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00448793
Message ID:
00449661
Views:
16
Hi, tries with this function.
*-----------------------------------------
* FUNCTION GMT_Time(ttDateTime)
*-----------------------------------------
FUNCTION GMT_Time(ttDateTime)
	IF EMPTY(ttDateTime)
		ttDateTime = DATETIME()
	ENDIF
	LOCAL lpTZI, ln, lnZT
	DECLARE GetTimeZoneInformation IN KERNEL32 ;
		STRING @lpTZI
	lpTZI = SPACE(255)
	ln = GetTimeZoneInformation(@lpTZI)
	lnZT = DW2N(SUBS(lpTZI, 1, 2))
	IF lnZT > 720
		lnZT = (2^16) - lnZT
	ELSE
		lnZT = lnZT	* (-1)
	ENDIF
	RETURN ttDateTime + lnZT*(-60)
ENDFUNC
*-----------------------------------------
* FUNCTION DW2N(tcDW)
*-----------------------------------------
FUNCTION DW2N(tcDW)
	RETURN ;
		ASC(SUBS(tcDW,4,1))*(256^3) + ;
		ASC(SUBS(tcDW,3,1))*(256^2) + ;
		ASC(SUBS(tcDW,2,1))*(256) + ;
		ASC(SUBS(tcDW,1,1))
ENDFUNC
*-----------------------------------------
Luis María Guayán
Tucumán, Argentina
________________________________
SysOp de www.PortalFox.com
Nada corre como un zorro
________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform