Instantiate Date Object

There's a catch to creating a date using the Date object's contructor: the time zone. This snippet shows how it's done

by Patrick Hund

JavaScript

var year = 2013, month = 1;

var mydate = new Date(Date.UTC(year, month - 1));

console.log('date:', mydate.toGMTString());