Instead of using classical format specifiers like "YYYY", "MM", "HH", "mm" etc., this function uses the Date instance getters like getFullYear
, getMonth
, etc., with support for zero-padding.
For example, instead of:
"YYYY-MM-DD HH:mm:ss"
you can use:
"{FullYear}-{Month:2}-{Date:2} {Hours:2}:{Minutes:2}:{Seconds:2}"
Verbose, but more human-friendly. And can be done within 140 bytes!
@subzey: Why didn't I think of that!? Thanks! Shaved 2 bytes.