Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   ISO8601ToDate ungültiger Zeitstring (https://www.delphipraxis.net/196566-iso8601todate-ungueltiger-zeitstring.html)

sh17 31. Mai 2018 10:39

Delphi-Version: 5

ISO8601ToDate ungültiger Zeitstring
 
ich möchte einen ISODateTime mit ISO8601ToDate umwandeln, bei '2018-05-31T00:00:00+02:00' kommt allerdings eine Exception, das der Zeitwert ungültig ist.

Stimmt das wirklich?

'2018-05-31T00:00:00.0+02:00' funktioniert, aber den Wert bekomme ich nun ja so (Aus einer SEPA CAM 052)

<CreDtTm>2008-09-24T17:54:47.0+01:00</CreDtTm>
<FrToDt>
<FrDtTm>2008-09-24T00:00:00+01:00</FrDtTm>
<ToDtTm>2008-09-24T24:00:00+01:00</ToDtTm>
</FrToDt>

p80286 31. Mai 2018 11:18

AW: ISO8601ToDate ungültiger Zeitstring
 
Interessant!
Ich wußte nicht, das die Zehntelsekunden zur Langform dazu gehören.
lt https://tools.ietf.org/html/rfc3339 ist das wohl so, Wikipedia bleibt im Unefähren:shock:

Gruß
K-H

Schokohase 31. Mai 2018 11:49

AW: ISO8601ToDate ungültiger Zeitstring
 
Laut RFC 3339 ist time-farction genauso optional wie time-zone
Code:
Time:

   time-hour        = 2DIGIT ; 00-24
   time-minute      = 2DIGIT ; 00-59
   time-second      = 2DIGIT ; 00-58, 00-59, 00-60 based on
                              ; leap-second rules
   time-fraction    = ("," / ".") 1*DIGIT
   time-numoffset   = ("+" / "-") time-hour [[":"] time-minute]
   time-zone        = "Z" / time-numoffset

   timeopt-hour     = "-" / (time-hour [":"])
   timeopt-minute   = "-" / (time-minute [":"])

   timespec-hour    = time-hour [[":"] time-minute [[":"] time-second]]
   timespec-minute  = timeopt-hour time-minute [[":"] time-second]
   timespec-second  = "-" timeopt-minute time-second
   timespec-base    = timespec-hour / timespec-minute / timespec-second

   time             = timespec-base [time-fraction] [time-zone]
Damit sind alle gezeigten Werte gültig im Sinne der RFC.

ISO8601ToDate dann wohl eher nicht.

sh17 31. Mai 2018 11:56

AW: ISO8601ToDate ungültiger Zeitstring
 
OK, in Tokyo ist der Fehler nicht mehr, betrifft nur mein Delphi Seattle. Scheint also behoben.


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:42 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz