Sample code for 30+ languages & platforms
DataFlex

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 DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoDt
    Boolean iBLocal
    String sTimestamp

    Move False To iSuccess

    Get Create (RefClass(cComCkDateTime)) To hoDt
    If (Not(IsComObjectCreated(hoDt))) Begin
        Send CreateComObject of hoDt
    End

    Get ComSetFromCurrentSystemTime Of hoDt To iSuccess

    // Get a UTC time.
    Move False To iBLocal
    Get ComGetAsTimestamp Of hoDt iBLocal To sTimestamp
    Showln "Current UTC Time: " sTimestamp

    // Get a local time.
    Move True To iBLocal
    Get ComGetAsTimestamp Of hoDt iBLocal To sTimestamp
    Showln "Current Local Time: " sTimestamp

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


End_Procedure