W3Schools
  home HOME All tutorials | References | Forum | About
Search W3Schools:

JS Reference
JS Overview
JS Array
JS Boolean
JS Date
JS Math
JS Number
JS String
JS RegExp
JS Functions
JS Events

DOM Objects
DOM Window
DOM Navigator
DOM Screen
DOM History
DOM Location

DOM Document

DOM Anchor
DOM Area
DOM Base
DOM Body
DOM Button
DOM Event
DOM Form
DOM Frame
DOM Frameset
DOM IFrame
DOM Image
DOM Input Button
DOM Input Checkbox
DOM Input File
DOM Input Hidden
DOM Input Password
DOM Input Radio
DOM Input Reset
DOM Input Submit
DOM Input Text
DOM Link
DOM Meta
DOM Object
DOM Option
DOM Select
DOM Style
DOM Table
DOM TableCell
DOM TableRow
DOM Textarea

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Tutorials
W3Schools Forum

Helping W3Schools

JavaScript getDate() Method


Date Object Reference Complete Date Object Reference

Definition and Usage

The getDate() method returns the day of the month.

Syntax

dateObject.getDate()


Tips and Notes

Note: The value returned by getDate() is a number between 1 and 31.

Note: This method is always used in conjunction with a Date object.


Example

In this example we print the day of the current month:

<script type="text/javascript">
var d = new Date();
document.write(d.getDate());
</script>

The output of the code above will be:



Example 2

Here we define a variable with a specific date and then print the day of the month in the variable:

<script type="text/javascript">
var birthday = new Date("July 21, 1983 01:15:00");
document.write(birthday.getDate());
</script>

The output of the code above will be:

21


Try-It-Yourself Demos

getDate()
How to use getDate() to get the day of the current month.

Display the current date in different formats
How to use getDate(), getMonth(), and getFullYear() to display the current date in different formats.


Date Object Reference Complete Date Object Reference

Learn how your website performs under various load conditions

Web Load and Performance Testing   

WAPT is a load, stress and performance testing tool for websites and web-based applications. In contrast to "800-pound gorilla" load testing tools, it is designed to minimize the learning curve and give you an ability to create a heavy load from a regular workstation. WAPT is able to generate up to 3000 simultaneously acting virtual users using standard hardware configuration. Virtual users in each profile are fully customizable. Basic and NTLM authentication methods are supported. Graphs and reports are shown in real-time at different levels of detail, thus helping to manage the testing process.

Download the free 30-day trial!



Jump to: Top of Page or HOME or Printer Friendly Printer friendly page

W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2008 by Refsnes Data. All Rights Reserved.

Validate Validate W3C-WAI level A conformance icon W3Schools was converted to XHTML in December 1999