Expand my Community achievements bar.

load a date

Avatar

Level 3

Hello

I need to use 3 variables for different thinks.

How can i load the day number, the month date and the year date ?

exemple :

//javascript code

var day = date("dd");

var month=date("mm");

var year = date("yyyy");

Thanlks !

1 Reply

Avatar

Former Community Member

var currDate = new Date();

// getMonth() returns 0 based month

var mm = currDate.getMonth() + 1;

// getDate() returns day of month 1-31

var dd = currDate.getDate();

// getFullYear() returns 4 digit year

var yyyy = currDate.getFullYear();

Steve