4 ms·
yyyy-mm-dd is so nice you can just work with strings for your date stuff, converting to objects and back is tedious Shameless plug: I built a python library to
by rchaves 6y ago
yyyy-mm-dd is so nice you can just work with strings for your date stuff, converting to objects and back is tedious
Shameless plug: I built a python library to do exactly that https://pypi.org/project/yyyy-mm-dd/ https://pypi.org/project/yyyy-mm-dd/
- grenoire 6y agoQuite nifty and clean; I think this could play well with support for the duration (P-Y-M-D...) format in ISO 8601 that declares a positive offset. https://en.wikipedia.org/wiki/ISO_8601#Durations https://en.wikipedia.org/wiki/ISO_8601#Durations
- akavel 6y agoInteresting, didn't know about that! Do you know of some canonical way of expressing negative offsets in spirit of ISO 8601? I don't seem to see those mentioned in the article...
- grenoire 6y agoUnfortunately not, for the project I'm working on right now I only needed 'forward' durations. There's a W3C extension that proposes a preceding - sign for negative durations, which I think it's fair https://www.w3.org/TR/xmlschema-2/#duration https://www.w3.org/TR/xmlschema-2/#duration. The ISO standard explicitly declares durations to be non-negative, on the other hand. As close to canonical as you can get.
- rswail 6y agoYou can specify an interval as start/duration, start/end, or duration/end. So you could specify a negative offset as a duration and the end time. P2H/2021-02-26T13:30Z is two hours prior or T11:30Z on the same date.
- globular-toast 6y agoIt's not tedious if you do it right. All of your conversions should be done in your I/O layer and nowhere else. For many applications that means there's a single place to do it. Hardly tedious. I notice that your library is targeted at notebooks, though. It seems useful in that context, but not for general programming.