Date.getDate() (Method)

Returns the day number within a month for a date/time.


ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Netscape Enterprise Server - 2.0
Opera - 3.0
Property/method value type:Number primitive
JavaScript syntax:-myDate.getDate()

This method returns a day number within a month from the date value of the receiving object. The value is 1 based and will not exceed 31 although the range is variable based on month and leap year contexts.

The date is computed according to local time coordinates.

Example code:

   // Create diary of special days per month
   myDiary = new Array();
   myDiary[1]  = "Pay into bank account";
   myDiary[28] = "Invoice customers";
   myDiary[14] = "Chase customers for payment";
   myDiary[5]  = "Top up fuel in generator";
   // Work out day number
   myDate = new Date();
   myDay = myDate.getDate();
   // Output message of the day

See also:Date.prototype, Date.setDate()


ECMA 262 edition 2 - section -

ECMA 262 edition 3 - section -