A Date new () and setDate () parameters
I believe the Internet has been a lot of articles about the date, here's just a matter of my own work and then met again be summarized;
new Date()
new Date () form a total of six, with one of the five parameters without parameters;
- new Date (); natural Needless to say, the default is the current date acquired.
- new Date ( "month1 dd, yyyy hh: mm: ss"); Note: the parameter is a character form
- new Date ( "month1 dd, yyyy"); Note: the parameter is a character form
- new Date (yyyy, month2, dd, hh, mm, ss); Note: The parameter is not character
- new Date (yyyy, month2, dd); Note: The parameter is not character
- new Date(ms);
Parameter Description:
month1: English, the name of the month; from January to December;
dd: date, and 1-31
yyyy: Represents the year represented four
hh: mm: ss: represents time, while (0-23) - min (0-59) - s (0-59)
month2: is a Number of the month; from 0-11; ie January to December
ms: number of milliseconds from between 1 January 1970 the difference
Special note: Some of the characters in the form of some not
setDate()
We often work with setDate () the date of realization of addition and subtraction; setDate () receives an integer, if this integer greater than the current time on the day of the month subject line is automatically go-ahead, the remainder is the date of the next month
var d=new Date(2019,1,21);
d.setDate(d.getDate()+15);
Special note: setDate () received an integer
A Date new () and setDate () parameters
I believe the Internet has been a lot of articles about the date, here's just a matter of my own work and then met again be summarized;
new Date()
new Date () form a total of six, with one of the five parameters without parameters;
- new Date (); natural Needless to say, the default is the current date acquired.
- new Date ( "month1 dd, yyyy hh: mm: ss"); Note: the parameter is a character form
- new Date ( "month1 dd, yyyy"); Note: the parameter is a character form
- new Date (yyyy, month2, dd, hh, mm, ss); Note: The parameter is not character
- new Date (yyyy, month2, dd); Note: The parameter is not character
- new Date(ms);
Parameter Description:
month1: English, the name of the month; from January to December;
dd: date, and 1-31
yyyy: Represents the year represented four
hh: mm: ss: represents time, while (0-23) - min (0-59) - s (0-59)
month2: is a Number of the month; from 0-11; ie January to December
ms: number of milliseconds from between 1 January 1970 the difference
Special note: Some of the characters in the form of some not
setDate()
We often work with setDate () the date of realization of addition and subtraction; setDate () receives an integer, if this integer greater than the current time on the day of the month subject line is automatically go-ahead, the remainder is the date of the next month
var d=new Date(2019,1,21);
d.setDate(d.getDate()+15);
Special note: setDate () received an integer