function doFormalTime() {
var myTime = new Date();
var myHour = myTime.getHours();
var myMinutes = myTime.getMinutes();
var ampm = " in the morning ";

if (myHour >= 12) {
myHour -= 12; // change to PM
ampm = "pm";
}
Hour = new Array(
"one", "two", "three", "four",
"five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve");

// gets nearest 5 minutes
myMin = myMinutes - (myMinutes % 5);
// closer to next 5 minutes, go to next
if (myMinutes % 5 > 2) myMin += 5;

var text = " ";

switch(myMin) {
case 0 : myHour--; break;
case 5 : text += "Five after "; myHour--; break;
case 10 : text += "Ten after "; myHour--; break;
case 15 : text += "Quarter after "; myHour--; break;
case 20 : text += "Twenty after "; myHour--; break;
case 25 : text += "Twenty-five after "; myHour--; break;
case 30 : text += "Half past "; myHour--; break;
case 35 : text += "Twenty-five till "; break;
case 40 : text += "Twenty till  "; break;
case 45 : text += "Quarter till "; break;
case 50 : text += "Ten till "; break;
case 55 : text += "Five till "; break;
case 60 : break;
}
if (myHour < 1) myHour++; // fix for noon/midnight
if (ampm == "pm") {
ampm = (myHour >= 4) ? " in the evening " : " in the afternoon ";
}
text += Hour[myHour] + ampm;
return text;
}
