[fpc-pascal] Zoned date/time conversions
Michael Van Canneyt
michael at freepascal.org
Sun May 24 13:56:54 CEST 2020
On Sun, 24 May 2020, Graeme Geldenhuys wrote:
> Hi,
>
> I need to do timezone enabled date/time conversions...
>
> Use case 1)
> We want the application server to always use UCT and the application
> server might not be in the sime timezone as the client app. So we need
> to convert local time to UCT, do some time based processing on the
> server, then return data and convert all times back to the local time.
>
> Use case 2)
> Client's home address is in Spain. The application server is hosted in
> London. The client is on holiday in Australia. They book a grocery
> delivery while on holiday, and it must be delivered at 4pm the day
> they return from their holiday. So 4pm will be local Spainish time.
>
>
> Data will be transported to/from the application server using JSON
> and REST API. So date/time info needs to be converted to/from string
> format.
>
> What classes or methods are available in FPC to convert local
> date/time to UCT based time with offset and zone information?
In the RTL, there is none.
There are some methods to find out local time zone, but that's about it.
However, there is some third-party class which has complete date/time
handling:
https://wiki.freepascal.org/PascalTZ
sources on :
https://github.com/dezlov/PascalTZ
Michael.
More information about the fpc-pascal
mailing list