Date Object
Date is a global object ready to be called upon at any time, the Date is a static object. When you wish to work with a date, you must to invoke the Date object constructor function to obtain an instance of a Date object. The value of a Date object is the time in milliseconds from zero o’clock on 1/1/ 1970. You can also grab a snapshot of the Date object for a particular date and time in the past or future by specifying that information as parameters to the Date object constructor function:
var dateObj = new Date(”Month dd, yyyy”);
Date object methods
var dateObj = new Date( );
- method dateObj.getTime( )
- value 0-…
- description milliseconds since 1-1-1970 GTM
———————————————
- method dateObj.getYear( )
- value 70-…
- description minus 1900;four-digit year for 2000+
———————————————
- method dateObj.getFullYear( )
- value 1970-…
- description four-digit year
———————————————
- method dateObj.getMonth( )
- value 0-11
- description month within the year
———————————————
- method dateObj.getDate( )
- value 1-31
- description date within the month
———————————————
- method dateObj.getDay( )
- value 0-6
- decsription day of week
———————————————
- method dateObj.getHours( )
- value 0-23
- description hour of the day (24 hour time)
———————————————
- method dateObj.getMinutes( )
- value 0-59
- description minute of the hour
———————————————
- method dateObj.getSeconds( )
- value 0-59
- description second within a minute
———————————————
- method dateObj.setTime( )
- value 0-…
- decsription milliseconds since 1-1-1970 GTM
———————————————
- method dateObj.setYear( )
- value 70-…
- description minus 1900;four digit year for 2000+
———————————————
- method dateObj.setMonth( )
- value 0-11
- description month within a year
———————————————
- method dateObj.setDate( )
- value 1-31
- description date within the month
———————————————
- method dateObj.setDay( )
- value 0-6
- description day of week
———————————————
- method dateObj.setHours( )
- value 0-23
- description hour of the day (24 hour time)
———————————————
- method dateObj.setMinutes( )
- value 0-59
- description minute of the hour
———————————————
- method dateObj.setSeconds( )
- value 0-59
- description second within the minute
———————————————
Note: the getMonth( ) and setMonth( ) method values are zero based; January is 0, December is 11.
Leave a Reply
You must be logged in to post a comment.
