
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to format a JavaScript date?
JavaScript date follows the formatting formats −
Date Type | Format |
---|---|
ISO Date | "2017-11-29" (The International Standard) |
Short Date | "11/29/2017" |
Long Date | "29 Nov 2017" |
Full Date | "Wednesday November 29 2017" |
Example
Here’s how you can display current date −
<!DOCTYPE html> <html> <body> <p>Click below to get the current date:</p> <button onclick="display()">Display Date</button> <p id="test"></p> <script> function display() { var date = new Date(); document.getElementById("test").innerHTML = date; } </script> </body> </html>
- Related Articles
- How to format date value in JavaScript?
- How to format JavaScript date into yyyy-mm-dd format?
- How to convert a date object to string with format hh:mm:ss in JavaScript?
- How to correctly convert a date format into a MySQL date?
- How to convert Python date format to 10-digit date format for mysql?
- Check valid date format in JavaScript?
- How to convert a date format in MySQL?
- How to format date in JSP?
- How to format a date to String in Java?
- How to format date string in PowerShell?
- How to convert US date format to MySQL format in INSERT query?
- How to print date in a regular format in Python?
- How to Format a Date String using SimpleDateFormat in Java?
- Convert MySQL Unix-Timestamp format to date format?
- How to convert a MySQL date to JavaScript date?

Advertisements