Create a Date object:
Copy Code code as follows:
var objdate=new Date ([arguments list]);
The following 5 kinds of parameter form are:
1) New Date ("Month dd,yyyy hh:mm:ss");
2) New Date ("Month dd,yyyy");
3) New Date (YYYY,MTH,DD,HH,MM,SS);
In the program I used the third initialization method, always show the format of the parameter is not correct, carefully read it must be integral type, I passed the string
4) New Date (YYYY,MTH,DD);
5 new Date (MS);
Note the last form, which represents the number of milliseconds to create and the difference between GMT time January 1, 1970. The meanings of the various functions are as follows:
Month: Month name in English, from January to December
MTH: Month by integer, from (January) to 11 (December)
DD: Represents the day ordinal of one months, from 1 to 31
YYYY: four-digit year
HH: Hours, from 0 (midnight) to 23 (11 o'clock in the evening)
MM: Number of minutes, integers from 0 to 59
SS: Number of seconds, integers from 0 to 59
MS: Number of milliseconds, integer greater than or equal to 0
Such as:
Copy Code code as follows:
New Date ("January 12,2006 22:19:35");
New Date ("January 12,2006");
New Date (2006,0,12,22,19,35);
New Date (2006,0,12);
New Date (1137075575000);
The various forms of creation above represent the day of January 12, 2006.