[fpc-pascal] Convert unix timestamp to TDateTime

José Mejuto joshyfun at gmail.com
Fri Nov 18 22:29:41 CET 2011


Hello FPC-Pascal,

Friday, November 18, 2011, 1:54:13 PM, you wrote:

SG>    I would like to convert a unix timestamp to TDateTime taking into
SG> account timezone and daylight savings. For example, timestamp:
SG> 1308666350 should be converted to: 2011/06/21 16:25:50, assuming GMT+1
SG> timezone in the winter (GMT+2 in the summer). I would like this
SG> conversion to work both during the summer and the winter, meaning that
SG> if I try to convert the above timezone during the winter time, it
SG> should work as well. So, I would like for the conversion to work
SG> similarly to: date -d @1308666350 +%Y/%m/%d\ %H:%M:%S . Is this
SG> something possible?

You need to use something like: http://wiki.lazarus.freepascal.org/PascalTZ

-- 
Best regards,
 José




More information about the fpc-pascal mailing list