document.write("I saw Jim ");stampDate = 12; stampHr = 7; stampMin = 50; offset = 0; now = new Date(); if ((now.getUTCDate() != stampDate) || (now.getUTCHours() < stampHr)) { document.write("yesterday (or even longer ago)"); } else { stampAbs = stampHr*60 + stampMin; nowAbs = now.getUTCHours()*60 + now.getUTCMinutes(); diffAbs = nowAbs - stampAbs; diffAbs = diffAbs + offset if (diffAbs > 120) document.write("at least a couple of hours ago"); else if (diffAbs > 60) document.write("over an hour ago"); else if (diffAbs > 30) document.write("in the last hour"); else if (diffAbs > 15) document.write("in the last half hour"); else if (diffAbs > 5) document.write("in the last fifteen minutes"); else document.write("just now"); } document.write(", he was ");document.write("not listening to anything");