Date & Time Modified

Press the button for the current date and time


Code Example

<script>
 var rightNow = new Date();
     alert("The day and exact time is " + rightNow);
     document.write("The day and exact time is " + rightNow);
  
 var dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
 var now = new Date();
 var theDay = now.getDay();
 var nameOfToday = dayNames[theDay];

 if (theDay === 0) {
    alert("Welcome to your " + nameOfToday + "day homeslice!");
    document.getElementById('txt').innerHTML = 'Today is Sunday, dude.';
    document.write("Welcome to your " + nameOfToday + " homeslice!");
 }

 else if (theDay === 1) {
    alert(nameOfToday + "day is all up in ya bidness!");
    document.write("<br><br>" + nameOfToday + " is all up in ya bidness!");
 }

 else if (theDay === 2) {
    alert("Welcome to your " + nameOfToday + "sday n' junk! Lunch is on me today.");
    document.write("Welcome to your " + nameOfToday + " n' junk! Lunch is on me today.");	
 }

 else if (theDay === 3) {
    alert("Hey, you made it to " + nameOfToday + "nesday! Half way there baby!");
    document.write("Hey, you made it to " + nameOfToday + "! Half way there baby!");	
 }

 else if (theDay === 4) {
    alert("Whoa! " + nameOfToday + "! The weekend is in sight!");
    document.write("Whoa! " + nameOfToday + "! The weekend is in sight!");	
 }

 else if (theDay === 5) {
    alert("Whoa! it's friggin' " + nameOfToday + "! The weekend is about to drop, yo!");
    document.write("Whoa! it's friggin' " + nameOfToday + "! The weekend is about to drop, yo!");	
 }

 else {
    alert("Dude, it's " + nameOfToday + "urday n' stuff!")
    document.write("Dude, it's " + nameOfToday + "urday n' stuff!");
 }
</script>