1

could you guys give a an example of a code that prints DateTimeToUnix in Pascal?

Found out a topic talking about in Delphi (DateTimeToUnix in UTC?), but i cant find a code example anywhere.

function DateTimeToUnix(

  const AValue: TDateTime

):Int64;

Here is an example in c#

    public static int UnixTimeStamp()
    {
        return (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
    }
}

Also, i did a little search and this function seems to print the System time without using timezone (UTC), so how i could adjust the result to the timezone i want (eg. UTC -3).

Thanks,

Community
  • 1
  • 1
niceguy335
  • 361
  • 1
  • 3
  • 7
  • If there is an algorithm (wikipedia or the places where you found the other language samples), then there should be a way to code it also in Pascal. Maybe you start with it and when - possibly with the help of others - it is finished, then there is some code sample :-) – Dilettant Jul 07 '16 at 11:48
  • 1
    What do you mean with "how to print DateTimeToUnix"? Just call the function DateTimeToUnix. The function converts a TDateTime value to Unix epoch time already. The function returns an Int64 which you can convert to String. – Alexander Baltasar Jul 08 '16 at 06:57

0 Answers0