Sample code for 30+ languages & platforms
PowerBuilder

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

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Dt
integer li_BLocal
string ls_Timestamp

li_Success = 0

loo_Dt = create oleobject
li_rc = loo_Dt.ConnectToNewObject("Chilkat.CkDateTime")
if li_rc < 0 then
    destroy loo_Dt
    MessageBox("Error","Connecting to COM object failed")
    return
end if

li_Success = loo_Dt.SetFromCurrentSystemTime()

// Get a UTC time.
li_BLocal = 0
ls_Timestamp = loo_Dt.GetAsTimestamp(li_BLocal)
Write-Debug "Current UTC Time: " + ls_Timestamp

// Get a local time.
li_BLocal = 1
ls_Timestamp = loo_Dt.GetAsTimestamp(li_BLocal)
Write-Debug "Current Local Time: " + ls_Timestamp

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


destroy loo_Dt