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!
Great work!
As far as I understand, you may use
… function(v,c,p){v=d["get"+c] …
instead of
… function(s,c,p,v){v=d["get"+c] …
Anyway, first argument is unused and v is assigned explicitly.