Forum Discussion

akuczkowski's avatar
akuczkowski
Contributor
8 years ago
Solved

Anyone know how to get Unix Time using DelphiScript?

I need the current datetime formatted as Unix time (the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970). Anyone know how to get that value? We are using TestComplete 11 and DelphiScript.

 

Thanks,

Adam

  • Sorry to answer my question, but it turned out this was easy to calculate using TestComplete DateTime methods.

     

    iUnixTimeInDays := aqConvert.VarToFloat(aqDateTime.TimeInterval(Now(), aqDateTime.SetDateTimeElements(1970,1,1,0,0,0)));
    iUnixTimeInSeconds := iUnixTimeInDays * 24 * 60 * 60;

1 Reply

  • Sorry to answer my question, but it turned out this was easy to calculate using TestComplete DateTime methods.

     

    iUnixTimeInDays := aqConvert.VarToFloat(aqDateTime.TimeInterval(Now(), aqDateTime.SetDateTimeElements(1970,1,1,0,0,0)));
    iUnixTimeInSeconds := iUnixTimeInDays * 24 * 60 * 60;