Sample code for 30+ languages & platforms
Xbase++

Extract Timestamp from ULID

See more ULID/UUID Examples

Extract the date/time from a ULID.

Important: Chilkat's ULID functionality was introduced in v9.5.0.94.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL cUlid
LOCAL oDt
LOCAL nBLocal

nSuccess := 0

cUlid := "01GRH14AA82EY9A7S99YYF2QDY"

oDt := CreateObject("Chilkat.CkDateTime")

//  Unix timestamps stored in ULIDs should be UTC...
nBLocal := 0
//  Set the CkDateTime from the timestamp contained in the ULID
nSuccess := oDt:SetFromUlid(nBLocal, cUlid)
IF (nSuccess == 0)
    ? "ULID was not valid."
    oDt:destroy()
    RETURN
ENDIF

//  You can now get the date/time in any desired format.
//  For example:
? "Unix timestamp = " + Str(oDt:GetAsUnixTime(nBLocal))
? "RFC822 = " + oDt:GetAsRfc822(nBLocal)
? "Timestamp = " + oDt:GetAsTimestamp(nBLocal)

//  Sample output:

//  Unix timestamp = 1675608861
//  RFC822 = Sun, 05 Feb 2023 14:54:21 GMT
//  Timestamp = 2023-02-05T14:54:21Z

oDt:destroy()