var d = new Date(); var ymd = d.strftime('%Y/%m/%d'); var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
var d = new Date(); d.strftime("%H:%M");
To get the current time with seconds in AM/PM notation:
var d = new Date(); d.strftime("%r");
To get the year and day of the year for August 23, 2009:
var d = new Date('2009/8/23'); d.strftime("%Y-%j");