Sample code for 30+ languages & platforms
Visual FoxPro

Get Current Date/Time as Timestamp (YYYY-MM-DDThh:mm:ssTZD)

Demonstrates how to get the current system date/time in YYYY-MM-DDThh:mm:ssTZD format.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loDt
LOCAL lnBLocal
LOCAL lcTimestamp

lnSuccess = 0

loDt = CreateObject('Chilkat.CkDateTime')

lnSuccess = loDt.SetFromCurrentSystemTime()

* Get a UTC time.
lnBLocal = 0
lcTimestamp = loDt.GetAsTimestamp(lnBLocal)
? "Current UTC Time: " + lcTimestamp

* Get a local time.
lnBLocal = 1
lcTimestamp = loDt.GetAsTimestamp(lnBLocal)
? "Current Local Time: " + lcTimestamp

* Sample output:
* 
* Current UTC Time: 2022-03-01T00:48:58Z
* Current Local Time: 2022-02-28T18:48:58-06:00

RELEASE loDt