Unix Time for Tdatetime

Asked

Viewed 144 times

0

I need to convert a received time into a json in the format 750382 for 00:12:41 in Delphi has the function Unixtodatetime() but it only works if I receive the full date and time, but in this case I only get the time, the full date and time are 10 digits, I have tried to supplement the other 4 digits with the current date but also does not work, I am using the site https://www.freeformatter.com/epoch-timestamp-to-date-converter.html to verify does anyone know how to do in this case? this value is a duration time in minutes...

Thank you!

1 answer

1

To create a date from Stamp (which I suppose to be in seconds) I could only do

  dt:=incSecond(0,750382);

using a dt variable of the Tdatetime type and the Incsecond function (Unit Dateutils)

However, the start dates of Delhi and Unix are different, so I think you need to use Unixdatedelta, which is the initial difference between the 2 formats

dt:=IncSecond(UnixDateDelta,750382);

I think it already works (I gave an hour less but I think it may have to do with the time difference, if that makes sense)

And by the way, using the site you gave as a reference, this Stamp gives me 09/01/1970, 17:26:22

Browser other questions tagged

You are not signed in. Login or sign up in order to post.