2 ms·
What's up buddy? My only real question: > rand_day = maya.when('2011-02-07', timezone='US/Eastern') This returning an object representing a DateTime on the 6
by jMyles 10y ago
What's up buddy?
My only real question:
> rand_day = maya.when('2011-02-07', timezone='US/Eastern')
This returning an object representing a DateTime on the 6th (in UTC time) strikes me as perhaps "not for humans."
If I just see that line casually, I think I expect to get a Date and for it to be the 7th.
It looks like, in order to get this (arguably expected) object, I need to take the resulting MayaDT epoch and run its `datetime` method, passing naive=True?
And I also see that _tz can only ever be pytz.timezone('UTC') - is this the result of some belief that timezones are illusions or something? :-)
For a while, I have kinda thought that timezones foment a confused mental model of time and teamwork. I prefer to think in terms of the astronomy - it's not actually a different time anywhere else, it's just that the sun is at a different position relative to the rest of the earth (and thus, ones faraway teammates and loved ones).
Anyway, thanks for yet another set of interesting ideas. Hope you are well.
- guitarbill 10y agoIt's worth thinking of it the same as strings. Strings can have several encodings, e.g. ASCII, UTF-8 and a hundred others. These are external representation. You don't want to parse the string every time you have to deal with it, so you parse it and store it using (ideally) a single internal representation (e.g. UCS-2, UCS-4). Then, when you need to pass the string to something else, you encode again. Same with dates. Instead of trying to deal with and store all possible representations (format, timezones, etc), you convert all dates to a single representation (hence UTC). When you need to output the date, encode it into whatever format and timezone you need. It's much cleaner this way, because there's less chance you'll mix up representations. So the "for humans" part is more "for developers, which are also humans but like to pretend they aren't and never make mistakes".