Date object

Represents date and time. Local and UTC timezones supported.

Properties

day - integer, number of the day, from 1 up to number of days in current month. Read/write property. local
time
month - integer, number of the month, from 1 to 12. Read/write property.
year - integer, full number of the year, e.g. 2005. Read/write property.
hour - integer, hour, from 0 to 23. Read/write property.
minute - integer, minute, from 0 to 59. Read/write property.
second - integer, second, from 0 to 59. Read/write property.
millisecond - integer, millisecond, from 0 to 999. Read/write property.
dayOfWeek - integer, number of day of the week, from 0 to 6 where 0 is Monday. Read-only property.
firstDayOfWeek - integer, from 0 to 6 where 0 is Monday - first day of the week in current locale. Read-only class property that can be used as Date.firstDayOfWeek.
UTCday - integer, number of the day, from 1 up to number of days in current month. Read/write property. UTC
time
UTCmonth - integer, number of the month, from 1 to 12. Read/write property.
UTCyear - integer, full number of the year, e.g. 2005. Read/write property.
UTChour - integer, hour, from 0 to 23. Read/write property.
UTCminute - integer, minute, from 0 to 59. Read/write property.
UTCsecond - integer, second, from 0 to 59. Read/write property.
UTCmillisecond - integer, millisecond, from 0 to 999. Read/write property.
UTCdayOfWeek - integer, number of day of the week, from 0 to 6 where 0 is Monday. Read-only property.

Methods

[new Date]

( [string |  [ year, month, day [, hour [, minute [, second [, millisecond ]]]]]] )

Creates new date object. If no parameters were given then initializes date fields to the current time (UTC).
If single string parameter provided then parses date contained in the string.
And if year, month, day, etc. provided uses these numeric values to initialize new Date instance.

new Date(string) form recognizes date in RFC-822 date format ( http://www.w3.org/Protocols/rfc822/#z28 ) and ISO 8601 ( http://www.w3.org/TR/NOTE-datetime ).

toString
() : string

Returns RFC-822 string representation of this date object.

toUTCString
() : string

Returns RFC-822 string representation of this date object as UTC date/time.

toISOString
( [asUTC: false|true ] )

Returns ISO 8601 string representation of this date object as either local or UTC date/time.

toLocaleString

( [longFormat] ) returns: string

Returns string representation of the date using current system settings. Local time.
If longFormat is equal exactly true then formats date using system long date format.

valueOf
() returns: float

Returns stored time value in milliseconds since midnight, January 1, 1970 UTC.

parse

( string ) returns: float | undefined

Static method. Tries to parse date in string. If result of parsing is successfull then returns date as number of milliseconds since midnight, January 1, 1970 UTC.
On error returns undefiend value.

UTC

( year, month, day [, hour [, minute [, second [, millisecond ]]]]] ) returns: float | undefined

Static method. Returns number of milliseconds since midnight, January 1, 1970 UTC up to date defined by parameters

setTime

( milliseconds ) returns: float

Sets this date object fields equal to date defined by milliseconds parameter. milliseconds is a number (float) of milliseconds since midnight, January 1, 1970 UTC.

monthName
( longFormat ) returns: string

Returns name of the month in current user's locale. If longFormat is equal true returns full month name, otherwise - it's abbreviation.

dayOfWeekName
( longFormat ) returns: string

Returns name of the day in current user's locale. If longFormat is equal true returns full week day name, otherwise - it's abbreviation.

isDaylight
( ) : true | false

Returns true if current clock is using daylight saving time.

timeZoneOffset
( ) : integer

Returns shift in milliseconds of current timezone from GMT.

timeZoneName
( ) : string

Returns name of current timezone.