Multi-Format Date
One date, many styles. This script demonstrates how to parse the JavaScript `Date` object and reconstruct it into various common string formats.
Today's Date:
- US Format (MM/DD/YYYY): ...
- EU Format (DD.MM.YYYY): ...
- ISO Format (YYYY-MM-DD): ...
- Long Format: ...
Copy the Script
<script>
var d = new Date();
var day = String(d.getDate()).padStart(2, '0');
var month = String(d.getMonth() + 1).padStart(2, '0');
var year = d.getFullYear();
document.write("US: " + month + "/" + day + "/" + year + "<br>");
document.write("EU: " + day + "." + month + "." + year + "<br>");
document.write("ISO: " + year + "-" + month + "-" + day);
</script>
Frequently Asked Questions
ISO 8601 (YYYY-MM-DD) is the international standard and sorts correctly in databases. US format is MM/DD/YYYY, while most of Europe uses DD/MM/YYYY.
Yes. Use `date.toLocaleDateString('en-US', { weekday: 'long' })` to get 'Monday', 'Tuesday', etc.
No. JavaScript runs on the client browser, so it displays the date set on the user's computer/device.