date diff calc

Tim Peters tim.peters at gmail.com
Tue Nov 30 10:49:36 EST 2004


[Skip Montanaro]
>>> I think inputs from strings would be much more common.

[Tim Peters]
>> Me too, although it's a bottomless pit.
>>
>> guess-6-intended-meanings-for-1/2/3-before-breakfast-ly y'rs

[Peter Hansen]
> I think Skip was intending that the format string be mandatory,
> to avoid such ambiguity.  At least, that's what I inferred from
> his example, where the format string came before the date string:
>
>   start = datetime.date.fromstring("%Y-%m-%d", "2004-11-25")

It's still a bottomless pit -- ask Brett, who implemented the Python
strptime <wink>.  But now that we *have* a portable strptime
implementation, perhaps it would be OK to teach datetime about it.

OTOH, is that what people really want?  For all I know,
rfc822.getdate() or rfc822.getdate_tz() are what's really wanted, or
maybe some DWIM thing like Zope's date guessers.

Does anyone want any of those enough to write the code, tests, and
docs?  If so, the first person to do so will probably win the debate
...



More information about the Python-list mailing list