DataFlex
DataFlex
DateTime - Get as Unix Time String
Demonstrates the GetAsUnixTimeStr method.Note: This example is only valid in Chilkat v9.5.0.65 or later.
Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoDateTime
Boolean iSuccess
Boolean iBLocal
String sTemp1
Get Create (RefClass(cComCkDateTime)) To hoDateTime
If (Not(IsComObjectCreated(hoDateTime))) Begin
Send CreateComObject of hoDateTime
End
Get ComSetFromCurrentSystemTime Of hoDateTime To iSuccess
// (in seconds since the epoch: 00:00:00 UTC on 1 January 1970)
Move True To iBLocal
Get ComGetAsUnixTimeStr Of hoDateTime iBLocal To sTemp1
Showln "Unix time: " sTemp1
// Sample output for test run on 2-Dec-2016:
// Unix time: 1480661608
End_Procedure