Short Date Script
A minimalist approach to displaying the current date. This script outputs the date in a compact numeric format, making it ideal for headers, logs, and mobile-friendly designs.
Compact Date Demo
Current Numeric Date
01/28/2026
Copy the Script
<script>
(function() {
var d = new Date();
var day = d.getDate();
var month = d.getMonth() + 1; // Months are zero-indexed
var year = d.getFullYear();
// Adding leading zeros for a cleaner look
if (day < 10) day = "0" + day;
if (month < 10) month = "0" + month;
var shortDate = month + "/" + day + "/" + year;
// Display the date
document.write(shortDate);
})();
</script>
FAQ
In JavaScript, the
getMonth() method returns a value from 0 to 11 (where 0 is January). We add 1 to match the standard 1-12 calendar month system.Yes. You can use
year.toString().slice(-2) to display only the last two digits (e.g., "26" instead of "2026").