Javascript Date

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Static method)
m
 
(3 intermediate revisions by one user not shown)
Line 2: Line 2:
  
 
==Constructor==
 
==Constructor==
new Date();
+
* '''new Date()'''
new Date(value);
+
* '''new Date(value)'''
new Date(year, month [, day, hour, minute, second, millisecond]);
+
* '''new Date(year, month [, day, hour, minute, second, millisecond])'''
  
 
Where:
 
Where:
 
* value - Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch).  
 
* value - Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch).  
 
 
* year - Integer value representing the year. Values from 0 to 99 map to the years 1900 to 1999.  
 
* year - Integer value representing the year. Values from 0 to 99 map to the years 1900 to 1999.  
 
 
* month - Integer value representing the month, beginning with 0 for January to 11 for December.
 
* month - Integer value representing the month, beginning with 0 for January to 11 for December.
 
 
* day - Integer value representing the day of the month.
 
* day - Integer value representing the day of the month.
 
 
* hour - Integer value representing the hour of the day.
 
* hour - Integer value representing the hour of the day.
 
 
* minute - Integer value representing the minute segment of a time.
 
* minute - Integer value representing the minute segment of a time.
 
 
* second - Integer value representing the second segment of a time.
 
* second - Integer value representing the second segment of a time.
 
 
* millisecond - Integer value representing the millisecond segment of a time.
 
* millisecond - Integer value representing the millisecond segment of a time.
  
'''If no arguments are provided, the constructor creates a JavaScript Date object for the current date and time according to system settings.'''
+
If no arguments are provided, the constructor creates a JavaScript Date object '''for the current date and time according to system settings'''.
 
+
==Static method==
+
Date.now()
+
  
 +
==Static methods==
 +
* '''Date.now()'''
 
Static method Date.now() returns Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch)
 
Static method Date.now() returns Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch)
  
Line 33: Line 25:
  
 
* '''getDate'''
 
* '''getDate'''
 +
Returns the day of the month (1-31) for the specified date according to local time.
 
* '''getDay'''
 
* '''getDay'''
 +
Returns the day of the week (0-6) for the specified date according to local time.
 
* '''getFullYear'''
 
* '''getFullYear'''
 +
Returns the year (4 digits for 4-digit years) of the specified date according to local time.
 
* '''getHours'''
 
* '''getHours'''
 +
Returns the hour (0-23) in the specified date according to local time.
 
* '''getMilliseconds'''
 
* '''getMilliseconds'''
 +
Returns the milliseconds (0-999) in the specified date according to local time.
 
* '''getMinutes'''
 
* '''getMinutes'''
 +
Returns the minutes (0-59) in the specified date according to local time.
 
* '''getMonth'''
 
* '''getMonth'''
 +
Returns the month (0-11) in the specified date according to local time.
 
* '''getSeconds'''
 
* '''getSeconds'''
 +
Returns the seconds (0-59) in the specified date according to local time.
 
* '''getTime'''
 
* '''getTime'''
 +
Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC (negative for prior times).
 
* '''getTimezoneOffset'''
 
* '''getTimezoneOffset'''
 +
Returns the time-zone offset in minutes for the current locale.
 
* '''getUTCDate'''
 
* '''getUTCDate'''
 +
Returns the day (date) of the month (1-31) in the specified date according to universal time.
 
* '''getUTCDay'''
 
* '''getUTCDay'''
 +
Returns the day of the week (0-6) in the specified date according to universal time.
 
* '''getUTCFullYear'''
 
* '''getUTCFullYear'''
 +
Returns the year (4 digits for 4-digit years) in the specified date according to universal time.
 
* '''getUTCHours'''
 
* '''getUTCHours'''
 +
Returns the hours (0-23) in the specified date according to universal time.
 
* '''getUTCMilliseconds'''
 
* '''getUTCMilliseconds'''
 +
Returns the milliseconds (0-999) in the specified date according to universal time.
 
* '''getUTCMinutes'''
 
* '''getUTCMinutes'''
 +
Returns the minutes (0-59) in the specified date according to universal time.
 
* '''getUTCMonth'''
 
* '''getUTCMonth'''
 +
Returns the month (0-11) in the specified date according to universal time.
 
* '''getUTCSeconds'''
 
* '''getUTCSeconds'''
 +
Returns the seconds (0-59) in the specified date according to universal time.
 +
 +
[[Category:Javascript]]

Latest revision as of 14:58, 1 April 2014

Date class in Yate's Javascript implementation.

[edit] Constructor

  • new Date()
  • new Date(value)
  • new Date(year, month [, day, hour, minute, second, millisecond])

Where:

  • value - Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch).
  • year - Integer value representing the year. Values from 0 to 99 map to the years 1900 to 1999.
  • month - Integer value representing the month, beginning with 0 for January to 11 for December.
  • day - Integer value representing the day of the month.
  • hour - Integer value representing the hour of the day.
  • minute - Integer value representing the minute segment of a time.
  • second - Integer value representing the second segment of a time.
  • millisecond - Integer value representing the millisecond segment of a time.

If no arguments are provided, the constructor creates a JavaScript Date object for the current date and time according to system settings.

[edit] Static methods

  • Date.now()

Static method Date.now() returns Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch)

[edit] Methods

  • getDate

Returns the day of the month (1-31) for the specified date according to local time.

  • getDay

Returns the day of the week (0-6) for the specified date according to local time.

  • getFullYear

Returns the year (4 digits for 4-digit years) of the specified date according to local time.

  • getHours

Returns the hour (0-23) in the specified date according to local time.

  • getMilliseconds

Returns the milliseconds (0-999) in the specified date according to local time.

  • getMinutes

Returns the minutes (0-59) in the specified date according to local time.

  • getMonth

Returns the month (0-11) in the specified date according to local time.

  • getSeconds

Returns the seconds (0-59) in the specified date according to local time.

  • getTime

Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC (negative for prior times).

  • getTimezoneOffset

Returns the time-zone offset in minutes for the current locale.

  • getUTCDate

Returns the day (date) of the month (1-31) in the specified date according to universal time.

  • getUTCDay

Returns the day of the week (0-6) in the specified date according to universal time.

  • getUTCFullYear

Returns the year (4 digits for 4-digit years) in the specified date according to universal time.

  • getUTCHours

Returns the hours (0-23) in the specified date according to universal time.

  • getUTCMilliseconds

Returns the milliseconds (0-999) in the specified date according to universal time.

  • getUTCMinutes

Returns the minutes (0-59) in the specified date according to universal time.

  • getUTCMonth

Returns the month (0-11) in the specified date according to universal time.

  • getUTCSeconds

Returns the seconds (0-59) in the specified date according to universal time.

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers