Unix Time for TDateTime

0

I need to convert a time received in a json in the format 750382 to 00:12:41 in delphi has the UnixToDateTime () function more only works if I receive the full date and time, but in this case I only receive the time, the full date and time are 10 digits, I have already tried to complement the other 4 digits with the current date plus it also does not work, I am using the site < a href="https://www.freeformatter.com/epoch-timestamp-to-date-converter.html"> link to check Does anyone know how to do this? this value is a duration time in minutes ...

Thank you!

    
asked by anonymous 05.03.2018 / 19:18

1 answer

0

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

  dt:=incSecond(0,750382);

using a TDatetime dt variable and the IncSecond (unit DateUtils) function

Because the start of the delphi and unix dates are different, so I think you have to use UnixDateDelta, which is the initial difference between the 2 formats

dt:=IncSecond(UnixDateDelta,750382);

I think this is already working (I gave it an hour less but I think it might have to do with the time zone, if that makes sense)

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

    
06.03.2018 / 22:34