Einzelnen Beitrag anzeigen

Der schöne Günther

Registriert seit: 6. Mär 2013
6.110 Beiträge
 
Delphi 10 Seattle Enterprise
 
#3

AW: UTC datetime string to TDateTime

  Alt 24. Jan 2017, 11:40
This is two steps:
  1. Parsing the String into a TDateTime
  2. Converting the TDateTime in UTC timezone to your local timezone

For Task 1, there is already a built-in routine if the String is a timestamp in ISO8601 format: ISO8601ToDate(..). This method can also automatically take care of converting to your local timezone or return UTC timezone.

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 regular expressions.
  Mit Zitat antworten Zitat