![]() |
Delphi-Version: 10 Berlin
UTC datetime string to TDateTime
There is sample datetime string in UTC:
Code:
Is it routine to convert it to TDateTime? Or I must do it manually?
UTC 2011-02-05 21:25:55
|
AW: UTC datetime string to TDateTime
You can use
![]() There are a few other conversion functions in System.DateUtils that might be useful too. |
AW: UTC datetime string to TDateTime
This is two steps:
For Task 1, there is already a built-in routine if the String is a timestamp in ISO8601 format: ![]() But your example is not. A valid ISO8601 timestamp would look like "2011-02-05T21:25:55Z" If you're out of luck regarding ISO8601, I'd use ![]() |
Re: UTC datetime string to TDateTime
Thank you guys! I did it classically (with lenght/pos/delete). Using RegEx will be better (for sure will be very simple, in two lines)?
|
AW: UTC datetime string to TDateTime
Never in 2 lines. As already mentioned look here:
![]() |
Re: UTC datetime string to TDateTime
Ok, thanks! Another question: how can I convert my datetime to ISO8601 with RegEx?
|
AW: UTC datetime string to TDateTime
|
AW: UTC datetime string to TDateTime
You don't need regular expressions if you just want to get the ISO8601 representation of a TDateTime. There's already a built-in
![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:15 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz