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

Reply via email to