|
The Date object enables basic storage and retrieval of dates and times.
JScript Date Object getDate Method
|
Returns the day of the month according to local time. |
Returns the day of the week according to local time. | |
Returns the 4-digit year according to local time. | |
Returns the hours according to local time. | |
Returns the number of milliseconds past the second according to local time. | |
Returns the number of minutes past the hour according to local time. | |
Returns the month value according to local time. | |
JScript Date Object getSeconds Method
|
Returns the number of seconds past the minute according to local time. |
Returns the time stored in a Date object. | |
Determines the difference in minutes between the time on the host computer and Universal Time Coordinated (UTC). | |
Returns the date of the month according to UTC. | |
Returns the day of the week according to UTC. | |
Returns the 4-digit year according to UTC. | |
Returns the hours according to UTC. | |
Returns the number of milliseconds past the second according to UTC. | |
Returns the number of minutes past the hour according to UTC. | |
Returns the month according to UTC. | |
Returns the number of seconds past the minute according to UTC. | |
Returns the VT_DATE value. | |
Returns the 2-digit year. | |
Parses a string containing a date and returns the number of milliseconds between that date and midnight, January 1, 1970. | |
Sets the numeric data according to local time. | |
Sets the 4-digit year according to local time. | |
Modifies the hours value according to local time. | |
Modifies the milliseconds value according to local time. | |
Modifies the minutes value according to local time. | |
Modifies the month according to local time. | |
Modifies the seconds according to local time. | |
Sets the date and time value directly. | |
Sets the numeric date in Universal Coordinated Time (UTC) | |
Sets the year value according to UTC. | |
Modifies the year value according to UTC. | |
Modifies the milliseconds according to UTC. | |
Modifies the minutes according to UTC. | |
Modifies the month according to UTC. | |
Modifies the seconds according to UTC. | |
Sets the 2-digit year. | |
Converts the date to a string using GMT conventions. | |
Converts the date to a string using the current locale. | |
Converts the date to a string using UTC conventions. | |
Computes the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (or GMT) and the supplied date. |
var newDateObj = new Date()
var newDateObj = new Date(dateVal)
var newDateObj = new Date(year, month, date[, hours[, minutes[, seconds[,ms]]]])
dateVal
If a numeric value, dateVal represents the number of milliseconds in Universal Coordinated Time between the specified date and midnight January 1, 1970. If a string, dateVal is parsed according to the rules in the parse method. The dateVal argument can also be a VT_DATE value as returned from some ActiveX objects.
year
The full year, for example, 1976 (and not 76). Required.
month
The month as an integer between 0 and 11 (January to December).
date
An integer between 1 and 31. Required.
hours
Must be supplied if minutes is supplied. An integer from 0 to 23 (midnight to 11pm) that specifies the hour. Optional.
minutes
Must be supplied if seconds is supplied. An integer from 0 to 59 that specifies the minutes. Optional.
seconds
Must be supplied if milliseconds is supplied. An integer from 0 to 59 that specifies the seconds. Optional.
ms
An integer from 0 to 999 that specifies the milliseconds. Optional.
A Date object contains a number representing a particular instant in time to within a millisecond. If the value of an argument is greater than its range or is a negative number, other stored values are modified accordingly. For example, if you specify 150 seconds, JScript redefines that number as 2 minutes and 30 seconds.
If the number is NaN, that indicates that the object does not represent a specific instant of time. If you pass no parameters to the Date object, it is initialized to the current time (UTC). A value must be given to the object before you can use it.
The range of dates that can be represented in a Date object is approximately 285,616 years on either side of January 1, 1970.
The Date object has two static methods that are called without creating a Date object. They are the parse and UTC methods.
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.