Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

JScript Date Object

The Date object enables basic storage and retrieval of dates and times.

Methods: JScript Date Object

JScript Date Object getDate Method

 

Returns the day of the month according to local time.

JScript Date Object getDay Method

Returns the day of the week according to local time.

JScript Date Object getFullYear Method

Returns the 4-digit year according to local time.

JScript Date Object getHours Method

Returns the hours according to local time.

JScript Date Object getMilliseconds Method

Returns the number of milliseconds past the second according to local time.

JScript Date Object getMinutes Method

Returns the number of minutes past the hour according to local time.

JScript Date Object getMonth Method

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.

JScript Date Object getTime Method

Returns the time stored in a Date object.

JScript Date Object getTimezoneOffset Method

Determines the difference in minutes between the time on the host computer and Universal Time Coordinated (UTC).

JScript Date Object getUTCDate Method

Returns the date of the month according to UTC.

JScript Date Object getUTCDay Method

Returns the day of the week according to UTC.

JScript Date Object getUTCFullYear Method

Returns the 4-digit year according to UTC.

JScript Date Object getUTCHours Method

Returns the hours according to UTC.

JScript Date Object getUTCMilliseconds Method

Returns the number of milliseconds past the second according to UTC.

JScript Date Object getUTCMinutes Method

Returns the number of minutes past the hour according to UTC.

JScript Date Object getUTCMonth Method

Returns the month according to UTC.

JScript Date Object getUTCSeconds Method

Returns the number of seconds past the minute according to UTC.

JScript Date Object getVarDate Method

Returns the VT_DATE value.

JScript Date Object getYear Method

Returns the 2-digit year.

JScript Date Object parse Method

Parses a string containing a date and returns the number of milliseconds between that date and midnight, January 1, 1970.

JScript Date Object setDate Method

Sets the numeric data according to local time.

JScript Date Object setFullYear Method

Sets the 4-digit year according to local time.

JScript Date Object setHours Method

Modifies the hours value according to local time.

JScript Date Object setMilliseconds Method

Modifies the milliseconds value according to local time.

JScript Date Object setMinutes Method

Modifies the minutes value according to local time.

JScript Date Object setMonth Method

Modifies the month according to local time.

JScript Date Object setSeconds Method

Modifies the seconds according to local time.

JScript Date Object setTime Method

Sets the date and time value directly.

JScript Date Object setUTCDate Method

Sets the numeric date in Universal Coordinated Time (UTC)

JScript Date Object setUTCFullYear Method

Sets the year value according to UTC.

JScript Date Object setUTCHours Method

Modifies the year value according to UTC.

JScript Date Object setUTCMilliseconds Method

Modifies the milliseconds according to UTC.

JScript Date Object setUTCMinutes Method

Modifies the minutes according to UTC.

JScript Date Object setUTCMonth Method

Modifies the month according to UTC.

JScript Date Object setUTCSeconds Method

Modifies the seconds according to UTC.

JScript Date Object setYear Method

Sets the 2-digit year.

JScript Date Object toGMTString Method

Converts the date to a string using GMT conventions.

JScript Date Object toLocaleString Method

Converts the date to a string using the current locale.

JScript Date Object toUTCString Method

Converts the date to a string using UTC conventions.

JScript Date Object UTC Method

Computes the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (or GMT) and the supplied date.

Syntax: JScript Date Object

var newDateObj = new Date()

var newDateObj = new Date(dateVal)

var newDateObj = new Date(year, month, date[, hours[, minutes[, seconds[,ms]]]])

Arguments: JScript Date Object

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.

Remarks: JScript Date Object

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.