[fpc-pascal] Converting http date back to TDateTime

Alexander Grotewohl alex at dcclost.com
Wed Apr 29 04:37:32 CEST 2020


Can't test, but from the docs shouldn't it be something like:

adateTime := ScanDateTime(
'ddd, dd mmm yyyy hh:mm:ss GMT',
'Wed, 29 Apr 2020 10:35:50 GMT');

--
Alexander Grotewohl
https://dcclost.com

________________________________
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> on behalf of Zamrony P. Juhara via fpc-pascal <fpc-pascal at lists.freepascal.org>
Sent: Tuesday, April 28, 2020 10:29:27 PM
To: FPC-Pascal Users Discussions <fpc-pascal at lists.freepascal.org>
Cc: Zamrony P. Juhara <zamronypj at yahoo.com>
Subject: [fpc-pascal] Converting http date back to TDateTime

Hi,

How do I convert string with HTTP date format such as

Wed, 29 Apr 2020 10:35:50 GMT

back to its TDateTime value?

I try with ScanDateTime()

adateTime := ScanDateTime(
     'ddd", "dd" "mmm" "yyyy" "hh:mm:ss" GMT"',
     'Wed, 29 Apr 2020 10:35:50 GMT');

but EConvertError exception is raised with message

Mismatch char " " <> "," at pattern position 5, string position 5


Zamroni
Fano Framework
https://fanoframework.github.io


Zamrony P. Juhara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200429/f8cd7605/attachment.html>


More information about the fpc-pascal mailing list