How to change date format in html
Question:
In HTML, I am date type, but it’s giving me yyyy-mm-dd. I want to use dd-mm-yyyy format.
Can anyone give me a suggestion?
<fieldset style = "font-size:15px;">
<input type="date" name = "fromdate" placeholder = "FROM: DD-MM-YYYY" />
</fieldset>
{% comment %} <option value="2P">2P</option> {% endcomment %}
<fieldset style = "font-size:15px;">
<input type="date" name = "todate" placeholder = "FROM: DD-MM-YYYY" />
</fieldset>
Answers:
Quoting from MDN docs:
Note: The displayed date format will differ from the actual value —
the displayed date is formatted based on the locale of the user’s
browser, but the parsed value is always formatted yyyy-mm-dd.
In HTML, I am date type, but it’s giving me yyyy-mm-dd. I want to use dd-mm-yyyy format.
Can anyone give me a suggestion?
<fieldset style = "font-size:15px;">
<input type="date" name = "fromdate" placeholder = "FROM: DD-MM-YYYY" />
</fieldset>
{% comment %} <option value="2P">2P</option> {% endcomment %}
<fieldset style = "font-size:15px;">
<input type="date" name = "todate" placeholder = "FROM: DD-MM-YYYY" />
</fieldset>
Quoting from MDN docs:
Note: The displayed date format will differ from the actual value —
the displayed date is formatted based on the locale of the user’s
browser, but the parsed value is always formatted yyyy-mm-dd.