[fpc-pascal] Converting http date back to TDateTime
Santiago A.
svaa at ciberpiula.net
Thu Apr 30 10:46:27 CEST 2020
El 29/04/2020 a las 19:31, Zamrony P. Juhara via fpc-pascal escribió:
> Yes, it works if I remove timezone part from pattern as suggested by
> Santiago. This one works
>
> adatetime := scanDateTime(
> 'ddd, dd mmm yyyy hh:mm:ss',
> 'Tue, 28 Apr 2020 10:11:12 GMT');
>
> So i guess, we must convert timezone information to local timezone
> manually.
yes.
In unit Dateutils
https://www.freepascal.org/docs-html/rtl/dateutils/index-5.html
You have a lot of handy functions:
function UniversalTimeToLocal(
UT: TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>
):TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>;
function UniversalTimeToLocal(
UT: TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>;
TZOffset: Integer
<https://www.freepascal.org/docs-html/rtl/system/integer.html>
):TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>;
function LocalTimeToUniversal(
LT: TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>
):TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>;
function LocalTimeToUniversal(
LT: TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>;
TZOffset: Integer
<https://www.freepascal.org/docs-html/rtl/system/integer.html>
):TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>;
function UniversalTimeToLocal(
UT: TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>
):TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>;
function UniversalTimeToLocal(
UT: TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>;
TZOffset: Integer
<https://www.freepascal.org/docs-html/rtl/system/integer.html>
):TDateTime
<https://www.freepascal.org/docs-html/rtl/system/tdatetime.html>;
function GetLocalTimeOffset: Integer
<https://www.freepascal.org/docs-html/rtl/system/integer.html>;
>
> Thank you
>
> Zamrony P. Juhara
> https://v3.juhara.com
> https://github.com/zamronypj
>
> Fano Framework
> https://fanoframework.github.io
>
> mod_pascal
> https://zamronypj.github.io/mod_pascal
>
> On Wed, Apr 29, 2020 at 16:40, Santiago A.
> <svaa at ciberpiula.net> wrote:
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> <mailto:fpc-pascal at lists.freepascal.org>
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
--
Saludos
Santiago A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200430/045f7e80/attachment-0001.html>
More information about the fpc-pascal
mailing list