3 ms·
I don't think any of these solutions is really right. formatted = Calendars::gregorian->format("y-m-d h:m:s z", date) is prefectly fine. And when you want
by squiggleblaz 8y ago
I don't think any of these solutions is really right.
formatted = Calendars::gregorian->format("y-m-d h:m:s z", date)
is prefectly fine. And when you want to do week-year formatting
formatted = Calendars::weekyear->format("y-m-d h:m:s z", date)
will get you there. And you can use the Islamic or Chinese or Persian or Javanese or Julian calendars without having to have additional confusions. You could reconstruct your own Gregorian lunar calendar and use it.
One of the major problems in the article is mixing two unrelated things into one package: the customary western calendar and the ISO week-year calendar. You can see why someone might want to do that (because some businesses like to use them both simultaneously for different purposes) but that was bad design (you can tell, because there's the same concept - the year - with two different possible values).
Since we can't always be precise, we need to make sure that we always improve our libraries so that they are confusion-proof. If it's explicit, it's good.