Javascript Reference
Categories: Date

javascript Date Description

@May 27, 2009, 3:11 a.m.
Date Firefox/Netscape/NN 2 IE 3 ECMA 1  

 

  

The Date object is a static object that generates instances by way of several constructor functions. Each instance of a Date object is a snapshot of the date and time, measured in milliseconds relative to zero hours on January 1, 1970. Negative millisecond values represent time before that date; positive values represent time since that date.

 

The typical way to work with dates is to generate a new instance of the Date object, either for now or for a specific date and time (past or future, using the client local time). Then use the myriad of available date methods to get or set components of that time (e.g., minutes, hours, date, month). Browsers internally store a date as the millisecond value at Coordinated Universal Time (UTC, which is essentially the same as Greenwich Mean Time, or GMT). When you ask a browser for a component of that time, it automatically converts the value to the local time zone of the browser based on the client computer's control panel setting for the clock and time zone. If the control panel is set incorrectly, time and date calculations may go awry.

 

Early versions of scriptable browsers had numerous bugs when working with the Date object.

 
Properties
 
constructor prototype
 
Methods
 
getDate( ) getDay( ) getFullYear( )
getHours( ) getMilliseconds( ) getMinutes( )
getMonth( ) getSeconds( ) getTime( )
getTimezoneOffset( ) getUTCDate( ) getUTCDay( )
getUTCFullYear( ) getUTCHours( ) getUTCMilliseconds( )
getUTCMinutes( ) getUTCMonth( ) getUTCSeconds( )
getVarDate( ) getYear( ) parse( )
setDate( ) setFullYear( ) setHours( )
setMilliseconds( ) setMinutes( ) setMonth( )
setSeconds( ) setTime( ) setUTCDate( )
setUTCFullYear( ) setUTCHours( ) setUTCMilliseconds( )
setUTCMinutes( ) setUTCMonth( ) setUTCSeconds( )
setYear( ) toDateString( ) toGMTString( )
toLocaleDateString( ) toLocaleString( ) toLocaleTimeString( )
toString( ) toTimeString( ) toUTCString( )
UTC( ) valueOf( )  
 
Creating a Date Object
 
var now = new Date( );
var myDate = new Date("month dd, yyyy hh:mm:ss");
var myDate = new Date("month dd, yyyy");
var myDate = new Date(yy, mm, dd, hh, mm, ss);
var myDate = new Date(yy, mm, dd);
var myDate = new Date(milliseconds);
buy atorvastatin 10mg generic <a href="https://lipiws.top/">order atorvastatin 40mg pill</a> lipitor 10mg without prescription
Gyxpyy - 4 months
atorvastatin 20mg uk <a href="https://lipiws.top/">buy lipitor pill</a> atorvastatin brand
Hexrhj - 4 months

Powered by Linode.