1.0 1.1, and updated the documentation in the old post along with it. The new release includes "Z" (US timezone abbreviation) and "o" (UTC offset) flags as well as brevity enhancements from Scott Trenda, along with several other new features including a standalone
dateFormat function, named and default masks (plus you can easily add your own), easier internationalization, etc.
This update includes one change which is not backwards compatible: mask characters and sequences no longer have to comprise entire words for them to be treated specially. The former handling was intended to make it dead-easy to mix literal characters into date masks, but ended up mostly just being a slight nuisance since most people didn't use it to embed dates in larger strings.
Check out the new Date Format!
timeFormatfunctions, since version 0.1.
4 thoughts on “Date Format 1.1”
Z at the end of a datetime format should refer to “Zulu” or UTC time (aka GMT) not any zone based in the USA
Date.prototypeobjects include a number of methods for working with date objects using UTC rather than local time.
The use of “Z” as a flag to indicate that the timezone abbreviation should be embedded in the formatted string comes from the C and POSIX standards for formatting time (see the date utility and strftime function).
It still isn’t a “US timezone abbreviation”, as stated it indicates a +0000 time offset, this is an offset from UTC and will always be several hours out from any US timezone. Zulu time was originally a military designation AFAIK.
@Jules, of course a literal “Z” in an ISO 8601-formatted time does not indicate a US timezone. It indicates that UTC time is being used. It would not be right to append a literal “Z” unless the
dateFormatfunction knew it was working with a UTC-based date object.
Edit: Date Format 1.2 supports conversion to UTC time.