Flylib.com

Books Software

 
 
 

Section 24.24. Date.getDate( ): return the day-of-the-month field of a Date


24.24. Date.getDate( ): return the day-of-the-month field of a Date

ECMAScript v1

24.24.1. Synopsis

date . geTDate( )

24.24.1.1. Returns

The day of the month of the specified Date object date , using local time. Return values are between 1 and 31.



24.25. Date.getDay( ): return the day-of-the-week field of a Date

ECMAScript v1

24.25.1. Synopsis

date . geTDay( )

24.25.1.1. Returns

The day of the week of the specified Date object date , using local time. Return values are between 0 (Sunday) and 6 (Saturday).



24.26. Date.getFullYear( ): return the year field of a Date

ECMAScript v1

24.26.1. Synopsis

date . getFullYear( )

24.26.1.1. Returns

The year that results when date is expressed in local time. The return value is a full four-digit year, including the century, not a two-digit abbreviation.



24.27. Date.getHours( ): return the hours field of a Date

ECMAScript v1

24.27.1. Synopsis

date . getHours( )

24.27.1.1. Returns

The hours field, expressed in local time, of the specified Date object date . Return values are between 0 (midnight) and 23 (11 p.m.).



24.28. Date.getMilliseconds( ): return the milliseconds field of a Date

ECMAScript v1

24.28.1. Synopsis

date . getMilliseconds( )

24.28.1.1. Returns

The milliseconds field, expressed in local time, of date .



24.29. Date.getMinutes( ): return the minutes field of a Date

ECMAScript v1

24.29.1. Synopsis

date . getMinutes( )

24.29.1.1. Returns

The minutes field, expressed in local time, of the specified Date object date . Return values are between 0 and 59.



24.30. Date.getMonth( ): return the month field of a Date

ECMAScript v1

24.30.1. Synopsis

date . getMonth( )

24.30.1.1. Returns

The month field, expressed in local time, of the specified Date object date . Return values are between 0 ( January) and 11 (December).



24.31. Date.getSeconds( ): return the seconds field of a Date

ECMAScript v1

24.31.1. Synopsis

date . getSeconds( )

24.31.1.1. Returns

The seconds field, expressed in local time, of the specified Date object date . Return values are between 0 and 59.



24.32. Date.getTime( ): return a Date in milliseconds

ECMAScript v1

24.32.1. Synopsis

date . getTime( )

24.32.1.1. Returns

The millisecond representation of the specified Date object date that is, the number of milliseconds between midnight (GMT) on 1/1/1970 and the date and time specified by date .

24.32.2. Description

getTime( ) converts a date and time to a single integer. This is useful when you want to compare two Date objects or to determine the time elapsed between two dates. Note that the millisecond representation of a date is independent of the time zone, so there is no getUTCTime( ) method in addition to this one. Don't confuse this getTime( ) method with the getday ( ) and getdate( ) methods , which return the day of the week and the day of the month, respectively.

Date.parse( ) and Date.UTC( ) allow you to convert a date and time specification to a millisecond representation without going through the overhead of first creating a Date object.

24.32.3. See Also

Date , Date.parse( ) , Date.setTime( ) , Date.UTC( )



24.33. Date.getTimezoneOffset( ): determine the offset from GMT

ECMAScript v1

24.33.1. Synopsis

date . getTimezoneOffset( )

24.33.1.1. Returns

The difference, in minutes, between GMT and local time.

24.33.2. Description

getTimezoneOffset( ) returns the number of minutes difference between the GMT or UTC time and the local time. In effect, this function tells you what time zone the JavaScript code is running in and whether or not daylight saving time is (or would be) in effect at the specified date .

The return value is measured in minutes, rather than hours, because some countries have time zones that are not at even one- hour intervals.