3 ms·
IT SHOULD NOT PICK A DAY! It should return (2010, 6) -- with no precision implied beyond the input. This is a major personal hobby-horse of mine, and I don't k
by blasdel 17y ago
IT SHOULD NOT PICK A DAY! It should return (2010, 6) -- with no precision implied beyond the input.
This is a major personal hobby-horse of mine, and I don't know of a library that does all of what I want by default. The constructor for datetime in Python's standard library comes very close:
datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
All of the time components have no implied precision beyond the input you've given -- "2009-06-04 3pm" is never implicitly upcast into "2009-06-04 15:00:00 UTC". This is awesome.
Unfortunately the date object used internally does not allow for partial precision, so datetime doesn't expose it.