function timeToString() { var tDate = new Date(); cHour = tDate.getUTCHours(); cMin = tDate.getUTCMinutes(); cSec = tDate.getUTCSeconds(); var tString = "Universal Time is-> " + cHour + ":" + cMin + ":" + cSec; return tString; } /** *@autor bobby.hagan @mdTransit *This function calculates the difference *between the current time and an earlier *@param currentHour, the current Hour *@param currentMin, the current Minute *@param currentSec, the current Second *@param oldHour, the earlier Hour *@param oldMin, the earlier Minute *@param oldSec, the earlier Second *@return temp, the difference in the format "Hour:Min:Sec" */ function calcTimeDiff(currentHour,currentMin,currentSec,oldHour, oldMin, oldSec){ //convert to secs tempCurrHour = currentHour * 3600; tempCurrMin = currentMin * 60 tempCurrSecs = tempCurrHour + tempCurrMin + currentSec; tempOldHour = oldHour * 3600; tempOldMin = oldMin * 60; tempOldSecs = tempOldHour + tempOldMin + oldSec; etime = tempCurrSecs - tempOldSecs; if (etime >= 3600){ //get the Hours etime = etime / 3600; rHour = Math.floor(etime); //alert("rHour is " + rHour); if ((etime % 1) > 0){ //get the minutes eMin = (etime % 1) * 60; rMin = Math.floor(eMin); //alert("rMin is " + rMin); if ((eMin % 1) > 0){ //Get the seconds eSec = (eMin % 1) * 60 rSecs = Math.round(eSec); //alert("rSecs is " + rSecs); } } } else if (etime < 3600 && etime >= 60) { rHour = 0; etime = etime / 60; //alert("etime is: " + etime); rMin = Math.floor(etime); //alert("rMin is: " + rMin ) if((etime % 1) > 0) rSecs = (etime % 1) * 60; //alert("rSecs is " + Math.round(rSecs)) rSecs = Math.round(rSecs); } else { rHour = 0 rMin = 0; if (etime < 0 && oldSec > currSec){ etime = 60 - oldSec + currSec; } rSecs = Math.round(etime); } //alert("Elapsed time is-> " + rHour + ":" + rMin + ":" + rSecs); temp = rHour + ":" + rMin + ":" + rSecs; return temp; } function test(){ var tDate = new Date(); alert(timeToString()); //calcTimeDiff(tDate.getUTCHours(),tDate.getUTCMinutes(), tDate.getUTCSeconds(), 14, 58, 05); //calcTimeDiff(16,12,51, 14, 58, 5); var tempHour = parseInt(getCookieValue("mdHour")); var tempMin = parseInt(getCookieValue("mdMin")); var tempSec = parseInt(getCookieValue("mdSec")); //setEMdTransitTime(tempHour,tempMin,tempSec); //alert(unescape(getCookieValue("mdETime"))); alert(getCookieValue("boo boo")); if (getCookieValue("boo boo") == ""){alert("You made a boo boo!!!");} }