4 ms·
All I want is a standard date format. I had it with .Net's `/Date(xyz)/` format.
by my_ghola 10y ago
All I want is a standard date format. I had it with .Net's `/Date(xyz)/` format.
- ihsw2 10y agoWhat's wrong with Unix timestamps (ie: integer or decimal) and UTC offset (string)?
- SigmundA 10y agoNothing, pick either and make part of the standard so that when it gets deserialized it becomes a actual date instead of a string or number. Wouldn't it be annoying if numbers and booleans didn't exist in JSON, you just used strings? Same thing, JSON has a few data types it just missing a very common one.
- xelxebar 10y agoThat would severely complicate implementations, not to mention encourage bad programming practices, all for dubious convenience. Somewhat surprisingly, human readable dates are an absolute mess of historical convention and complicated geophysics. To write a human readable date, at the most basic level, requires us to account for both calendar for and time zone. But even that isn't enough. To get these display dates to match up with everything else in the world we also have to worry about a whole smorgasboard of national holidays, differing leap year conventions, leap seconds, historical mishaps, typographic conventions, and host of even more obscure minutia. All this complexity obscures from the programmer that human readable dates, for the above reasons, are almost useless at reliably determining time sequences. Instead, we should think of dates as UI details on the same level as a color scheme. Usually what we want is better thought of as a point in a time sequence which is best represented as ITA timestamps, e.g. Unix Time.