Date Format UTC in javascript [duplicate]

You need to look into using the JavaScript Date object.

var theDate = new Date(); //outputs current date/time
var theDate2 = new Date("01/02/2010"); //outputs the passed date and time (time will default to 12:00 or 00:00. I can't remember)

From W3 Schools

var d = new Date();
var d = new Date(milliseconds);
var d = new Date(dateString);
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);

This is not jQuery but I don’t understand what you’re trying to accomplish yet so I can only provide the basic guidance.

Looks like you could also benefit from utilizing the .getUTCDate() property of the Date object as well:

Leave a Comment