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-boun...@lists.freepascal.org> on behalf of Zamrony 
P. Juhara via fpc-pascal <fpc-pascal@lists.freepascal.org>
Sent: Tuesday, April 28, 2020 10:29:27 PM
To: FPC-Pascal Users Discussions <fpc-pascal@lists.freepascal.org>
Cc: Zamrony P. Juhara <zamron...@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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to