Date formats and ISO 8601

Dave S snidely.too at gmail.com
Wed Jul 27 01:00:10 UTC 2016


On Tue, Jul 26, 2016 at 12:53 PM, Marcus Harnisch
<marcus.harnisch at verilab.com> wrote:
> Hi Adrian
>
> Indeed, I was referring to the ‘T’ that is generated by ClearCase -fmt "%d".
>
> Without having the ISO document for reference (just looking at the Wikipedia
> page), I understand the sentence such that separators may be “omitted” as in
> “dropped” rather than “exchanged for whitespace”.

I don't have direct access to the standard, either, but excerpts I
have seen (via Google search, etc) have shown whitespace (or at least
a ' ', ASCII 0x20) as valid, I believe.  I think the prior DIN
document that influenced 8601 is available for reading on the web, but
influence varies, of course.

> The issue resembles that of encoder vs decoder. If one tool generates one
> specific compliant format variant it can rightfully claim “compliance”, if
> OTOH another tool consumes one specific compliant format it cannot make the
> same claim. So I guess I got confused by the reference to ISO 8601. Although
> not a Python expert, I would find it rather surprising if Python didn't have
> a fully compliant ISO 8601 parser though, which I think could be useful to
> add.

Python (2.x) datetime objects include an isoformat() method that
defaults to including the 'T', but has an optional separator argument
that is intended for substituting whitespace (as in their example).
<URL:https://docs.python.org/2/library/datetime.html#datetime-objects>

The datetime.strptime() function doesn't explicitly handle reading the
'T', but generating a format string to do that is straightforward.
<URL:https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior>

>
> For my specific issue I found a workaround, since ClearCase's "%Vd" format
> is supported by Mercurial.
>
> Thank you (and also Matt, whose mail has just popped up)
> Marcus

/dps


> On Tue, Jul 26, 2016 at 7:24 PM, Adrian Klaver <adrian.klaver at aklaver.com>
> wrote:
>>
>> On 07/26/2016 12:46 AM, Marcus Harnisch wrote:
>>>
>>> Hi all
>>>
>>> I just happened to notice that contrary to claims made by "hg help
>>> dates", Mercurial does not support ISO 8601 format (cf.
>>> https://en.wikipedia.org/wiki/ISO_8601). Could this be added? A common
>>> standard would be really helpful in scripts where tools might generate
>>> time stamps to be used by Mercurial.
>>
>>
>> I am guessing you are referring to the lack of T. That is permitted:
>>
>>
>> https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations
>>
>>
>> It is permitted to omit the 'T' character by mutual agreement.[21]
>>
>> 21. "ISO 8601:2004(E)". ISO. 2004-12-01. "4.3.2 NOTE: By mutual agreement
>> of the partners in information interchange, the character [T] may be omitted
>> in applications where there is no risk of confusing a date and time of day
>> representation with others defined in this International Standard."
>>
>>>
>>> Thanks
>>> Marcus
>>>
>>>
>>>
>>> _______________________________________________
>>> Mercurial mailing list
>>> Mercurial at mercurial-scm.org
>>> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>>>
>>
>>
>> --
>> Adrian Klaver
>> adrian.klaver at aklaver.com
>
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>



-- 
test signature -- please apply at front gate on Tuesdays only.



More information about the Mercurial mailing list