Java Reference
In-Depth Information
> chanukah.toString();
<< "Tue Dec 16 2014 00:00:00 GMT+0000 (GMT)"
> eid = new Date('Saturday, July 18, 2015');
<< [object Date]{
> eid.toString();
<< "Sat Jul 18 2015 00:00:00 GMT+0100 (BST)"
JavaScript is very flexible in the date format, which can be used in the string that is
provided as an argument; however, in order to be more consistent, it is better to provide
each bit of information about the date as a separate argument. The parameters that can be
provided are as follows:
new Date(year,month,day,hour,minutes,seconds,millisecons)
Here is an example:
> easter = new Date(2015, 3, 05);
<< [object Date]{
> easter.toString();
<< "Sun Apr 05 2015 00:00:00 GMT+0100 (BST)"
Notice that the months start counting at zero, so January is 0, February is 1, and so on up
to December, which is 11.
An alternative is to use a timestamp, which is a single integer argument that represents the
number of milliseconds since the Epoch (1st January 1970):
> diwali = new Date(1414018800000);
<< [object Date]{
Search WWH ::

Custom Search