To create a new Date object in node.js
, or JavaScript
in general, just call it’s initializer
var d = new Date();
var d = new Date(dateString);
var d = new Date(jsonDate);
var d = new Date(year, month, day);
var d = new Date(year, month, day, hour, minute, second, millisecond);
Remember that Date objects can only be instantiated by calling Date
or using it as a constructor; unlike other JavaScript object types, Date objects have no literal syntax