3 ms·
Are these date format strings part of ISO-8601 or standardized in some way? They look pretty much identical in JS and Python. If so, maybe a big help in preven
by Waterluvian 8y ago
Are these date format strings part of ISO-8601 or standardized in some way? They look pretty much identical in JS and Python.
If so, maybe a big help in preventing human error are editor plugins that verbalize what a given string represents. I found the regex websites that do this to be invaluable in learning and validating regex.
- saagarjha 8y ago> Are these date format strings part of ISO-8601 or standardized in some way? They look pretty much identical in JS and Python. They’re part of Unicode. > maybe a big help in preventing human error are editor plugins that verbalize what a given string represents This is a good idea, but it’s easy to get this wrong. There are websites that let you enter a format string and it will format the date for you as a “preview”, and they often have a list of format specifiers that you can pick from. The issue is that it’s easy to pick YYYY because it might end up coming first in the list and have a description like “the year”, which makes it seem no different than the one you’d want to use.
- em500 8y agoThey're very different from the format strings in Python, which takes format strings from the [C standard library](https://en.cppreference.com/w/c/chrono/strftime https://en.cppreference.com/w/c/chrono/strftime), which is different from (and older than) these Unicode format srrings. Same holds for other libc based languages like Perl or R. JS does not have native datetime format strings AFAIK, and 3rd party libs such as moment.js often invent their own strings.