To set a time, use the (very convenient) Dat eobject:

var now = new Date();

If you want to set a certain date, use:

var someDate = new Date("yyyy-mm-ddThh:mm:ss+hh:mm");

e.g.:

var someDate = new Date("2012-05-17T00:00:00+02:00");

For May 17th, 2012 00:00:00, CEST. Notice (and I just found that out), not all browsers take the same timezone when it is not supplied. To be sure, use the time zone in your date definition.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.