Here’s one way. You have to get the individual components from the date object (day, month & year) and then build and format the string however you wish.
n = new Date(); y = n.getFullYear(); m = n.getMonth() + 1; d = n.getDate(); document.getElementById("date").innerHTML = m + "/" + d + "/" + y;
<p id="date"></p>
Related Posts:
- Is there any way to change input type=”date” format?
- HTML Display Current date
- How to make a monopoly board using css grid?
- Redirect from an HTML page
- How to horizontally center an element
- Android WebView err_unknown_url_scheme
- How to create an HTML button that acts like a link
- What is the main difference of
and - Why does z-index not work?
- Is it possible to write data to file using only JavaScript?
- Image is not showing in browser?
- Is it possible to write data to file using only JavaScript?
- Which is better: or
- Adding attribute in jQuery
- Is
element block level or inline level?
- XPath //div[contains(text(), ‘string’)] fails to select divs containing ‘string’
- Two divs side by side – Fluid display
- Proper way to make HTML nested list?
- FontAwesome icons are not showing, Why?
- Remove border from IFrame
- CSS horizontal scroll
- mailto using javascript
- Mailto using Javascript?
- Can I set subject/content of email using mailto:?
- How do I set a background-color for the width of text, not the width of the entire element, using CSS?
- text-overflow: ellipsis not working
- How to reference nested classes with css?
- How to save user input into a variable in HTML and JavaScript
- Why is there an unexplainable gap between these inline-block div elements?
- How to make JavaScript execute after page load?
- Hide element by class in pure Javascript
- How to align content of a div to the bottom
- How to draw a dotted line with css?
- Function not defined javascript
- Navigate to an anchor on another page
- What is gZip compression?
- How to stick text to the bottom of the page?
- How to make blinking/flashing text with CSS 3
- How to center content in a Bootstrap column?
- HTML5 Validation Error: body start tag seen but an element of the same type was already open
- How do I install a custom font on an HTML site
- How to align an input tag to the center without specifying the width?
- How can I embed video for discord directly from website?
- Basic CSS – how to overlay a DIV with semi-transparent DIV on top
- difference between width auto and width 100 percent
- Is there a command for formatting HTML in the Atom editor?
- How to show text on image when hovering?
- Is it still valid to use IE=edge,chrome=1?
- Fit background image to div
- Table scroll with HTML and CSS
- Set cellpadding and cellspacing in CSS?
- CSS content property: is it possible to insert HTML instead of Text?
- How to increase height of textarea using bootstrap rows and columns
- Indent List in HTML and CSS
- What’s the difference between using NAV and DIV around Bootstrap 3 navbars?
- Absolute position is not working
- Position absolute but relative to parent
- How do you specify table padding in CSS? ( table, not cell padding )
- Two Divs next to each other, that then stack with responsive change
- link not working
- Generating a Random Number for HTML
- HTML Links are not working
- How to extract svg as file from web page
- Making an image act like a button
- Is it possible to use css to shrink text to automatically fit the size of the div
- HTML5 Canvas Rotate Image
- How can I align text directly beneath an image?
- HTML vs SHTML vs PHTML
- Change background color of iframe issue
- jQuery find element by data attribute value
- Keep HTML format when switching from Visual to HTML editor
- Get entire page content (generated HTML in browser)
- Can I force WordPress to use instead of ?
- Will my WordPress site become vulnerable to Cross-Site Scripting (XSS) if I allow img tags in the comments area?
- Add HTML to single post tag
- WordPress “Page not found error” when I edit a page
- How do I put a wordpress blog into my html site?
- New to CMS – WP functionality. overkill or just right?
- how add custom tag/tool in classic editor?
- Attribute Quote Style in WordPress HTML
- Allow HTML in Settings API input field
- Create custom markup to use in posts?
- Widget Text Needs to be White [closed]
- Why can’t I edit HTML in WordPress even with the administrator role?
- Adding HTML to posts with certain tags?
- Adding to the WYSIWYG
- How to remove auto generated markup? [closed]
- Is there a common structure for a wordpress formular?
- a generated wordpress page from a form that is inputted by user [closed]
- creates an unnecessary space in content?
- Echo outside HTML
- Add html plugin into wordpress
- WBR tag breaking hyperlinks
- allow html characters on eshop data entry boxes
- Query WordPress Database and Post HTML Table
- theme or plugin or server is outputting html before the init hook fires, how is it possible to prevent this
- How to Know If I’ve Correctly Inserted Alt Attributes Into HTML
- WordPress HTML editor panel is not showing HTML elements
- How to hide unwanted HTML Comment like in website [duplicate]
- HTML code not working in WordPress