SysTime.fromISOString
Russel Winder via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 13 06:35:20 PDT 2017
On Sat, 2017-05-13 at 05:30 -0700, Jonathan M Davis via Digitalmars-d-
learn wrote:
>
> […]
I can see I am not going to win the YYYY-MM discussion so I'll stand
down. Until I have read the latest version of the standard – I remain
sure this is a reduced accuracy not a truncated representation. But I
could just be wrong.
> The expectation is that you know which format you're dealing with.
> std.datetime is not written with the idea that you're dealing with a
> string
> with an arbitrary date/time format, and it's going to figure out what
> it is.
> It's written with the idea that you know exactly which format the
> string is
> in, and it converts the string based on the rules for that format.
> The ISO
> basic format and ISO extended format are two different formats. And
> in my
> experience, when applications are exchanging information via ISO
> strings,
> it's well-defined which format they're going to use. If you're
> actually
> dealing with a situation where it's not well-defined, then yes, using
> std.datetime becomes more painful.
I have just done the obvious cascaded try/catch block to try from the
most specific to the least specific, but I'll drop that here as you
have got stuck in to dealing with in the other email. (Which is great,
thanks for taking the time.)
> A magic parsing function which supported both the ISO basic format
> and the
> ISO extended format as well as the various truncated versions of
> those
> formats could be written, but it would be very error-prone and in at
> least
> some situations, it would be ambiguous, meaning that it could easily
> make
> the wrong choice. Using the truncated forms really only works when
> two
> applications have agreed on exactly how they're going to handle that,
> which
> is likely the reason that the spec says that they're there for if
> applications agree upon them rather than requiring that an
> application that
> supports either the ISO basic format or the ISO extended format
> supports the
> truncated versions.
I think my situation is not the general case so actually I have no
problem. But I shall shift this to the other thread.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20170513/854b63a8/attachment.sig>
More information about the Digitalmars-d-learn
mailing list