>? DATETIME() - lnTimeZoneOffset
>
>And it said that there was a 4 hour difference, but I'm running it on my laptop. Shouldn't it have just returned the current date and time?* Doug Hennig's code. * Here's some code that retrieves local time zone information: LOCAL ; lcTimeZone, ; lnID, ; lnStandardOffset, ; lnDaylightOffset * Declare the time zone information API function and get the time zone * information. #DEFINE TIME_ZONE_SIZE 172 DECLARE INTEGER GetTimeZoneInformation IN kernel32 ; STRING @lpTimeZoneInformation lcTimeZone = REPLICATE(CHR(0), TIME_ZONE_SIZE) lnID = GetTimeZoneInformation(@lcTimeZone) * Determine the standard and daylight time offset. lnStandardOffset = CTOBIN(SUBSTR(lcTimeZone, 1, 4), '4RS') lnDaylightOffset = CTOBIN(SUBSTR(lcTimeZone, 169, 4), '4RS') * Determine the total offset based on whether the computer is on daylight * time or not. Get the description for the time zone. IF lnID = 2 && daylight time lcTimeZoneDesc = STRTRAN(STRCONV(SUBSTR(lcTimeZone, 89, 64), ; 6), CHR(0), '') lnTimeZoneOffset = (lnStandardOffset + lnDaylightOffset) * 60 ELSE && standard time lcTimeZoneDesc = STRTRAN(STRCONV(SUBSTR(lcTimeZone, 5, 64), ; 6), CHR(0), '') lnTimeZoneOffset = lnStandardOffset * 60 ENDIF lnID = 2 * You can then add lnTimeZoneOffset to a local time value to get a time in Greenwich * Mean Time (GMT) or subtract lnTimeZoneOffset from a time value in GMT to obtain a * local time value. ? DATETIME() - lnTimeZoneOffset