Skip to content

Instantly share code, notes, and snippets.

@mikz
Created March 19, 2012 11:32
Show Gist options
  • Save mikz/2108442 to your computer and use it in GitHub Desktop.
Save mikz/2108442 to your computer and use it in GitHub Desktop.
var d = new Date()
var h = d.getHours()
if (h < 5){
document.write("Today is ")
}
else
if (h < 9){
document.write("Today is ")
}
else
if (h < 12){
document.write("Today is ")
}
else
if (h < 18){
document.write("Today is ")
}
else
if (h < 22){
document.write("Today is ")
}
else {
document.write("Today is ")
}
//-->
</SCRIPT>
<script>
<!--
var now = new Date();
var yr = now.getYear();
var mName = now.getMonth() + 1;
var dName = now.getDay() + 1.;
var dayNr = ((now.getDate()<10) ? "" : "")+ now.getDate();
if(dName==1) Day = "Sunday, ";
if(dName==2) Day = "Monday, ";
if(dName==3) Day = "Tuesday, ";
if(dName==4) Day = "Wednesday, ";
if(dName==5) Day = "Thursday, ";
if(dName==6) Day = "Friday, ";
if(dName==7) Day = "Saturday, ";
if(mName==1) Month="January";
if(mName==2) Month="February";
if(mName==3) Month="March";
if(mName==4) Month="April";
if(mName==5) Month="May";
if(mName==6) Month="June";
if(mName==7) Month="July";
if(mName==8) Month="August";
if(mName==9) Month="September";
if(mName==10) Month="October";
if(mName==11) Month="November";
if(mName==12) Month="December";
// String to display current date.
var todaysDate =(" "
+ Day
+ " "
+ dayNr
+ ". "
+ Month
+ " "
+ " "
+ yr);
// Write date to page.
document.open();
document.write("<font face=Verdana, Arial size=3> " +todaysDate+"</font>");
// -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment