The Date class provides means to manipulate current date.
When the timezone is not defined, the default timezone of the phone will be used.
However, the most commonly used timezone for "universal" UTC timestamps is the
"GMT" (Greenwich Meridian Time) timezone.
The "GMT" timezone is guaranteed to work on all phones. Some phones
may also support the "GTM+X:XX" or "GMT-X:XX" form.
A list of supported timezones can also be retrieved from the MeMo console using
the info command (key '3').
Since 1.4.1, all get* and to* methods (Date.getYear(),
Date.getMonth(), ...) accept two optional arguments a timestamp
and a timezone.
Only exception is getTime() that accepts multiple optional arguments to
define a timestamp from a list of values (year, month, day, etc.).
New methods: getWeek(), parseDate() and toString().
New constants: MIN, HOUR, DAY, WEEK.
int getDay ([int timestamp, [String timezone]]):
Returns the current day of the month, or the day of the month corresponding to
the given timestamp.
int getDayOfWeek ([int timestamp, [String timezone]]):
Returns day of the week (monday=1, sunday=7).
int getHour ([int timestamp, [String timezone]]):
Returns the current hour, or the hour corresponding to the given timestamp.
int getMinute ([int timestamp, [String timezone]]):
Returns the current minute, or the minute corresponding to the given timestamp.
int getMonth ([int timestamp, [String timezone]]):
Returns the current month number, or the month number corresponding to the given timestamp.
int getSecond ([int timestamp, [String timezone]]):
Returns the current second, or the year corresponding to the given timestamp.
int getTime ([int year, [int month, [int day, [int hour, [int min, [int sec, [String timezone]]]]]]]):
Returns the current time when no parameters are defined.
Returns the time given by the optional arguments in seconds since midnight, January 1, 1970 UTC, or 0 on error.
Default values of optional args: month is 1, day is 1, hour is 0, min is 0,
sec is 0 (e.g. timestamp returned for Date.getTime(2009) equals Date.getTime(2009, 1, 1, 0, 0, 0))
Default timezone is the current phone timezone.
int getWeek ([int timestamp, [String timezone]]):
Returns the current week number, or the week number corresponding to the given timestamp.
Since 1.4.1
int getYear ([int timestamp, [String timezone]]):
Returns the current year, or the year corresponding to the given timestamp.
int parseDate (String isoDate, [String timezone]):
Returns a timestamp by parsing an
ISO-8601 formated string, or 0 on error.
Only the following two extended formats are supported:
Note:
the presence of the separators ('-', 'T' and ':') between the numbers is
mandatory, but their value be changed (e.g. "2009 11 29 11!57!23Z" is a valid string).
If a timezone is given, the returned timestamp will be converted to it.
Since 1.4.1
int time ():
DEPRECATED
Use the getTime() method.
String toString ([int timestamp, [int timezone]]):
Returns a
ISO-8601 formated string using current time, or the given timestamp time.
Since 1.4.1
int DAY:
Number of seconds in a day (86400).
Since 1.4.1
int HOUR:
Number of seconds in an hour (3600).
Since 1.4.1
int MINUTE:
Number of seconds in a minute (60).
Since 1.4.1
int WEEK:
Number of seconds in a week (604800).
Since 1.4.1