Current Date Display

Show visitors exactly what day it is. This script formats the raw system date into a user-friendly, human-readable string.

Today is
Loading...

Copy the Script

<div id="dateLocation"></div>

<script>
var mydate = new Date();
var year = mydate.getFullYear();
var day = mydate.getDay();
var month = mydate.getMonth();
var daym = mydate.getDate();

var dayarray = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var montharray = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

// Add suffix (st, nd, rd, th)
var suffix = "th";
if (daym == 1 || daym == 21 || daym == 31) suffix = "st";
else if (daym == 2 || daym == 22) suffix = "nd";
else if (daym == 3 || daym == 23) suffix = "rd";

document.getElementById("dateLocation").innerHTML = 
    dayarray[day] + ", " + montharray[month] + " " + daym + suffix + ", " + year;
</script>

Frequently Asked Questions

JavaScript's `getMonth()` returns a number from 0-11. To show 'January', you need an array of names to map that number to a string.

This specific script runs once on page load. If you want the date to change exactly at midnight while the user is watching, you would need to wrap it in a `setInterval` function.

Yes. You can rearrange the variables (day, date, month, year) in the string concatenation line to match your preferred region (US vs UK format).