here’s some code that works for different time zones. however the “Seconds” don’t show/work as there’s no coding for them.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”>
<html xmlns=”
<head>
<title>Time Zones</title>
<script language=”Javascript” type=”text/javascript”>
<!– Hide script from old browsers
dayName = new Array (“Sunday”,”Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”)
function showTheHours(theHour) {
if (theHour == 0) {
return (12)
}
if (theHour < 13) {
return (theHour)
}
return (theHour-12)
}
function showZeroFilled(inValue) {
if (inValue > 9) {
return “:” + inValue
}
return “:0” + inValue
}
function showAmPm(thatTime) {
if (thatTime < 12) {
return (” AM “)
}
return (” PM “)
}
function showTheTime(tzOffset) {
thatTZ = new Date
dateStr = thatTZ.toGMTString()
dateStr = dateStr.substr(0,dateStr.length – 3)
thatTZ.setTime(Date.parse(dateStr))
thatTZ.setHours(thatTZ.getHours() + tzOffset)
return showTheHours(thatTZ.getHours()) + showZeroFilled(thatTZ.getMinutes()) + showAmPm(thatTZ.getHours()) + dayName[thatTZ.getDay()]
}
// End hiding script from old browsers –>
</script>
</head>
<body bgcolor=”#FFFFFF”>
<table width=”345″ border=”0″ cellspacing=”0″
cellpadding=”3″ bgcolor=”#000000″>
<tr>
<td valign=”top”>
<script language=”Javascript” type=”text/javascript”>
<!– Hide script from old browsers
document.write(‘<font face=”Arial, Helvetica, sans-serif” size=”2″>’);
document.write(‘<font color=”#FFFF66″>’);
document.write(“Jerusalem: ” + showTheTime(0))
// End hiding script from old browsers –>
</script>
</td>
<td valign=”top”>
<script language=”Javascript” type=”text/javascript”>
<!– Hide script from old browsers
document.write(‘<font face=”Arial, Helvetica, sans-serif” size=”2″>’);
document.write(‘<font color=”#66CCFF”>’);
document.write(“Ottawa: ” + showTheTime(-5))
// End hiding script from old browsers –>
</script>
</td>
</tr>
</table>
</body>
and here’s a revised script trying to add the seconds. however it doesn’t work.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”>
<html xmlns=”
<head>
<title>Time Zones</title>
<script language=”Javascript” type=”text/javascript”>
<!– Hide script from old browsers
dayName = new Array (“Sunday”,”Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”)
function showTheHours(theHour) {
if (theHour == 0) {
return (12)
}
if (theHour < 13) {
return (theHour)
}
return (theHour-12)
}
function showZeroFilled(inValue) {
if (inValue > 9) {
return “:” + inValue
}
return “:0” + inValue
}
function showSeconds(theSeconds){
if (inValue > 9 {
return “:” + theSeconds
{
return “:0” + theSeconds
}
function showAmPm(thatTime) {
if (thatTime < 12) {
return (” AM “)
}
return (” PM “)
}
function showTheTime(tzOffset) {
thatTZ = new Date
dateStr = thatTZ.toGMTString()
dateStr = dateStr.substr(0,dateStr.length – 3)
thatTZ.setTime(Date.parse(dateStr))
thatTZ.setHours(thatTZ.getHours() + tzOffset)
thatTZ.setSeconds(thatTZ.getSeconds() + tzOffset)
return showTheHours(thatTZ.getHours()) + showZeroFilled(thatTZ.getMinutes()) + showZeroFilled(thatTZ.getseconds()) + showAmPm(thatTZ.getHours()) + dayName[thatTZ.getDay()]
}
// End hiding script from old browsers –>
</script>
</head>
<body bgcolor=”#FFFFFF”>
<table width=”345″ border=”0″ cellspacing=”0″
cellpadding=”3″ bgcolor=”#000000″>
<tr>
<td valign=”top”>
<script language=”Javascript” type=”text/javascript”>
<!– Hide script from old browsers
document.write(‘<font face=”Arial, Helvetica, sans-serif” size=”2″>’);
document.write(‘<font color=”#FFFF66″>’);
document.write(“Jerusalem: ” + showTheTime(0))
// End hiding script from old browsers –>
</script>
</td>
<td valign=”top”>
<script language=”Javascript” type=”text/javascript”>
<!– Hide script from old browsers
document.write(‘<font face=”Arial, Helvetica, sans-serif” size=”2″>’);
document.write(‘<font color=”#66CCFF”>’);
document.write(“Ottawa: ” + showTheTime(-5))
// End hiding script from old browsers –>
</script>
</td>
</tr>
</table>
</body>
does anyone know how to fix this so that the “Seconds” show up and tick away.
any help would be appreciated.
Apu.
?