Java Reference
In-Depth Information
}
> diwali.toString();
<< "Thu Oct 23 2014 00:00:00 GMT+0100 (BST)"
Note: The Epoch
The Epoch is 1st January, 1970. This is an arbitrary date that is used in pro-
gramming as a reference point in time from which to measure dates. This
allows dates to be expressed as an integer that represents the number of
seconds since the Epoch. It results in a very large number and there is a
potential problem looming in 2038 when the number of seconds since the
Epoch will be greater than 2,147,483,647, which is the maximum value that
many computers can deal with as a signed 32-bit integer. Fortunately, this
problem will not affect JavaScript dates because it uses floating-point num-
bers rather than integers, so it can handle bigger values.
Getter Methods
The properties of date objects are unable to be viewed or changed directly. Instead, they
have a number of methods known as getter methods that return information about the date
object, such as the month and year.
Once you have created a date object it will have access to all the getter methods. There are
two versions of each method, one that returns the information in local time and the other
that uses Coordinated Universal Time (UTC).
Note: Coordinated Universal Time
UTC is the primary time standard by which the world regulates clocks. It
was formalized in 1960 and is much the same as Greenwich Mean Time
(GMT). The main difference is that UTC is a standard that is defined by the
scientific community, unlike GMT.
The getDay() and getUTCDay() methods are used to find the day of the week that the
date object falls on. It returns a number, starting at 0 for Sunday, up to 6 for Saturday:
 
Search WWH ::




Custom Search