On Sat, 3 Oct 2020, Ryan Joseph via fpc-pascal wrote:
I have some dates formats like this which I would like to convert to TDateTime.
Are these supported in the RTL? I tried using the StrToDate functions but I got
errors.
program test;
uses
SysUtils;
begin
StrToDate('2001-12-14T21:59:43.10Z-05:00');
end.
Do you ever read the documentation ?
You might then have read why the above will never work.
You probably need this:
https://www.freepascal.org/docs-html/current/rtl/dateutils/iso8601todate.html
or even this
https://www.freepascal.org/docs-html/current/rtl/dateutils/scandatetime.html
If you need full timezone handling, then there are no such routines in the
RTL. However, there is somewhere a package (I believe it is mentioned in the
wiki) that handles timezones and whatnot.
Michael.
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal