Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting DateTime variable to GMT or UTC
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00448793
Message ID:
00449661
Vues:
18
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
________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform