Java Reference
In-Depth Information
> diwali.getDay(); // it's on a Thursday
<< 4
The getDate() and getUTCDate() methods return the day of the month for the date
> diwali.getDate(); // it's on the 23rd
<< 23
The getMonth() and getUTCMonth() methods can be used to find the month of the
date object. It returns an integer, but remember that JavaScript starts counting at 0, so Janu-
ary is 0, February is 1, and so on up to December being 11:
> diwali.getMonth(); // it's in October
<< 9
The getFullYear() and getUTCFullYear() methods return the year of the date
object. There is also a getYear() method, but it isn't Y2K compliant, so shouldn't be
> diwali.getYear(); // broken for years after 2000
<< 114
> diwali.getFullYear(); // use this instead
<< 2014
There are also getHours() , getUTCHours() , getMinutes() ,
getUTCMinutes() , getSeconds() , getUTCSeconds , getMilliseconds() ,
and getUTCMilliseconds() methods that will return the hours, minutes, seconds and
milliseconds since midnight.
The getTime() method returns a timestamp representing the number of milliseconds
since the Epoch:
> diwali.getTime();
<< 1414018800000
Search WWH ::

Custom Search