Select a different time zones


 


500

Show LiveClock source code


<script type="text/javascript" >
function getSysClock() {
var sTime = new Date() ; sMin = sTime.getMinutes() ; sSec = sTime.getSeconds() ; sHrs = sTime.getHours() ;
var ap = "am" ;
if ( sHrs == 0 ) { sHrs = 12 ; ap = "am" ; }
else { if ( sHrs == 12 ) { sHrs = 12 ; ap = "pm" ; }
else { if ( sHrs > 12 ) { sHrs = sHrs - 12 ; ap = "pm" ; }
}}
var yourTime = "System Clock: " + ( ( sHrs < 10 )? "0" + sHrs : sHrs ) + ":" + ( ( sMin < 10 )? "0" + sMin : sMin ) + ":" + ( ( sSec < 10 )? "0" + sSec : sSec ) + " " + ap ;
document.forms[ "cpuT" ].clockString.value = yourTime ;
setTimeout( 'getSysClock() ; ', 100 ) ;
}
function getSysDate() {
var sTime = new Date() ;
var sSec = sTime.getSeconds() ;
var interval = ( 60 - sSec + 2 ) * 1000 ;
var yourDate = formatedDate() ;
document.forms[ 'cpuD' ].dateString.value = yourDate ;
var DTo = setTimeout( 'getSysDate() ; ', interval ) ;
}
<?php
$tZone = $_REQUEST[ 'tZone' ] ;
$dsplPic = 0 ;
$qry = $_SERVER[ 'QUERY_STRING' ] ;
if ( $qry == NULL ) { $q = "" ; }
else { $q = "?".$qry ; }
$jw = '/home/esand/public_html' ;
$bw = $jw.'/liveClock' ;
include ( $bw.'/timeChange.php' ) ;
include ( $bw.'/disclaim.php' ) ;
include ( $bw.'/displayTime.htm' ) ;
?>
var clock1 = ' ' ; var clock2 = ' ' ; var clock3 = ' ' ; var clock4 = ' ' ; var clock5 = ' ' ; var clock6 = ' ' ; var clock7 = ' ' ;
function setClockVariables() {
if ( tZone == "GMT" ) { document.forms[ "clock2" ].display2.value = clock2 ; }
else { document.forms[ "clock2" ].display2.value = clock6 ; }
document.forms[ "clock3" ].display3.value = clock7 ;
}
function startClock() {
if ( clock2 == ' ' ) {
tellTime() ;
getSysClock() ;
getSysDate() ;
}}
</script>

<style type="text/css">
div.s1 input { font: 20px Courier New ; color: #0000FF ; text-align: center ; width: 450px ; height: 24px ; border: 0 ; background-color: transparent ; }
div.s2 input { font: 50px Courier New ; color: #0000FF ; font-weight: bold ; text-align: center ; width: 450px ; height: 54px ; border: 0 ; background-color: transparent ; opacity: 0.5 ; }
div.s3 input { font: 20px Courier New ; color: #0000FF ; text-align: center ; width: 450px ; height: 24px ; border: 0 ; background-color: transparent ; font-weight: bold ; }
div.s4 input { font: 100px Courier New ; color: #0000FF ; font-weight: bold ; padding: 10px ; text-align: center ; width: 1200px ; height: 120px ; border: 0 ; background-color: transparent ; opacity: 0.5 ; }
</style>

<div align="center" style="border: 1px solid #C60000 ; margin-top: 50px ; background-color: #DEDEFF ; " >
<br>&nbsp;<br>
<div align="center" class="s2" >
<form id="clock2" >
<input type="text" name="display2" readonly >
</form>
</div>
<div align="center" id="SysClock" class="s3" >
<form id="cpuT" >
<input type="text" name="clockString" readonly >
</form>
</div>
<div align="center" id="SysDate" class="s3" >
<form id="cpuD" >
<input type="text" name="dateString" readonly >
</form>
</div>
<div align="center" class="s3" >
<form id="clock3" >
<input type="text" name="display3" readonly >
</form>
</div>
<div align="center" >
<br>
<a href="https://liveclock.org" class="u" >Select a different time zones</a>
</div>
<p><br>&nbsp;</p>
</div>



<?php
function getParm( $in ) {
if ( isset( $_REQUEST[ $in ] ) ) { return $_REQUEST[ $in ] ; }
else { return ' ' ; }
}
$zoneV = " " ; $tZ = " " ; $tZone = " " ;
$noParms = 0 ;
$tZone = getParm( 'tZone' ) ;
if ( ( $tZone == ' ' ) | ( $tZone == NULL ) ) {
$cont = " " ; $zone = " " ;
$cont = getParm( 'contin' ) ;
$zone = getParm( 'zone' ) ;
if ( ( $cont == ' ' ) | ( $zone == ' ' ) ) {
$noParms = 1 ;
$tZone = "GMT" ;
$zoneV = "America/New_York" ;
$currentOnlineState = 1 ;
$previousOnlineState = 1 ;
}
else {
$tZone = str_replace( "_", " ", $zone ) ;
if ( $tZone == "Rio de Janeiro" ) { $cont = "America" ; $zone = "Sao_Paulo" ; }
elseif ( $tZone == "DumontDUrville" ) { $cont = "Antarctica" ; $tZone = "Dumont d'Urville" ; }
$zoneV = $cont.'/'.$zone ;
}}
elseif ( $tZone == "Hawaii-Aleutian" ) { $zoneV = "Pacific/Honolulu" ; $tZone="Hawaii/Aleutians" ; }
elseif ( $tZone == "Honolulu" ) { $zoneV = "Pacific/Honolulu" ; }
elseif ( $tZone == "Tokyo" ) { $zoneV = "Asia/Tokyo" ; }
elseif ( $tZone == "London" ) { $zoneV = "Europe/London" ; }
else {
if ( isset( $cont ) ) { ; } else { $cont = ' ' ; }
if ( $cont == ' ' ) {
$qZ = strtolower( $tZone ) ;
if ( $qZ > ' ' ) {
if ( $qZ == "new_york" ) { $zoneV = "America/New_York" ; $tZone = "Eastern" ; }
elseif ( $qZ == "chicago" ) { $zoneV = "America/Chicago" ; $tZone= "Central" ; }
elseif ( $qZ == "denver" ) { $zoneV = "America/Denver" ; $tZone= "Mountain" ; }
elseif ( $qZ == "los_angeles" ) { $zoneV = "America/Los_Angeles" ; $tZone= "Pacific" ; }
elseif ( ( $tZone == "Atlantic" ) | ( $tZone == "Eastern" ) | ( $tZone == "Central" ) | ( $tZone == "Mountain" ) | ( $tZone == "Pacific" ) ) { ; }
elseif ( ( $tZone == "Hawaii-Aleutian" ) | ( $tZone == "Tokyo" ) | ( $tZone == "London" ) | ( $tZone == "GMT" ) ) { ; }
elseif ( $qZ == "atlantic" ) { $zoneV = "America/New_York" ; $tZone = "Atlantic" ; }
elseif ( $qZ == "eastern" ) { $zoneV = "America/New_York" ; $tZone = "Eastern" ; }
elseif ( $qZ == "central" ) { $zoneV = "America/Chicago" ; $tZone= "Central" ; }
elseif ( $qZ == "mountain" ) { $zoneV = "America/Denver" ; $tZone= "Mountain" ; }
elseif ( $qZ == "pacific" ) { $zoneV = "America/Los_Angeles" ; $tZone= "Pacific" ; }
else {
$tZ = "Parameter setting '".$tZone."' is not recognized." ;
$noParms = 1 ;
$tZone = "Eastern" ;
$zoneV = "America/New_York" ;
}
$cont = " " ;
$zone = " " ;
}}
}

if ( $zoneV == " " ) {
switch ( $tZone ) {
case "Atlantic" : $zoneV = "America/Halifax" ; break ;
case "Eastern" : $zoneV = "America/New_York" ; break ;
case "Central" : $zoneV = "America/Chicago" ; break ;
case "Mountain" : $zoneV = "America/Denver" ; break ;
case "Pacific" : $zoneV = "America/Los_Angeles" ; break ;
default : $tZone = "GMT" ; $zoneV = "America/New_York" ;
}}
if ( date_default_timezone_set( $zoneV ) ) { ; }
else {
$tZ = "Time zone '".$zoneV."' is not recognized." ;
$noParms = 1 ;
$tZone = "Eastern" ;
$zoneV = "America/New_York" ;
date_default_timezone_set( $zoneV ) ;
}
$hr = date( 'g' ) ;
$min = intval( date( 'i' ) ) ;
$sec = intval( date( 's' ) ) ;
$hoursZulu = gmdate( 'G' ) ;
$minZulu = intval( gmdate( 'i' ) ) ;
$weekDay = date( 'l' ) ;
$wDayShort = date( 'D' ) ;
$AMPM = date( 'a' ) ;
$offset = intval( date( 'O' ) ) ;
$hrsOffset = intval( $offset / 100 ) ;
$minOffset = abs( $offset ) - abs( $hrsOffset * 100 ) ;
$suf = "" ;
$clt = array() ;
$clt = localtime() ;
$dst = $clt[ 8 ] ;
$clhr = $clt[ 2 ] ;
if ( $dst > 0 ) { $dst = 1 ; } else { $dst = 0 ; }
if ( ( $tZone == 'Atlantic' ) | ( $tZone == 'Eastern' ) | ( $tZone == 'Central' ) | ( $tZone == 'Mountain' ) | ( $tZone == 'Pacific' ) ) { ; }
else {
if ( isset( $cont ) ) { ; } else { $cont = ' ' ; }
if ( ( $tZone == 'GMT' ) | ( $cont == ' ' ) ) { ; }
else {
if ( ( $cont == 'America' ) | ( $cont == 'Europe' ) | ( $cont == 'Africa' ) | ( $cont == 'Atlantic' ) | ( $cont == 'Asia' ) | ( $cont == 'Austrailia' ) ) { $suf = 'in ' ; }
else { $suf = '('.$wDayShort.') at ' ; }
}}
print ( '
var hours = '.$hr.' ;
var hoursZulu = '.$hoursZulu.' ;
var minZulu = '.$minZulu.' ;
var minutes = '.$min.' ;
var seconds = '.$sec.' ;
var ampm = "'.$AMPM.'" ;
var tZone = "'.$tZone.'" ;
var offset = '.$hrsOffset.' ;
var minOffset = '.$minOffset.' ;
var suf = "'.$suf.'" ;
var timeChange = '.$timeChange.' ;
var localTm = '.$noParms.' ;
var DST = '.$dst.' ;
' ) ;
$longDate = date( 'l' ).", ".date( 'F' )." ".date( 'j' ).", ".date( 'Y' ) ;
print ( '
var longDate = "'.$longDate.'" ;
' ) ;
?>
var tmDesc = ampm + suf ;
var time = new Date() ;
var sysHrs =0 ;
var sysMin = 0 ;
var sysSec = 0 ;
var sysOff = time.getTimezoneOffset() / 60 ;
var clock1 = " " ;
var clock2 = " " ;
var clock3 = " " ;
var clock4 = " " ;
var clock5 = " " ;
var clock6 = " " ;
var clock7 = " " ;
var clock8 = " " ;
var useSysClock = 0 ;
var clockDec = 0 ;
var hours24 = 0 ;
var min24 = 0 ;
var mn = 0 ;
var sysHoff = 0 ;
var sysMoff = 0 ;
var sysSoff = 0 ;
var sTemp = 0 ;
var mTemp = 0 ;
var hTemp = 0 ;
var sec = "00" ;
var mnZ = "00" ;
var hrZ = "00" ;
var clientZ = " " ;
var noReload = 0 ;
var monthNow = 0 ;
var weekdayNow = 0 ;
var dayNow = 0 ;
var onlineState = 0 ;
var checkInterval = 20 ;

function getClock() {
var time = new Date() ; sysMin = time.getMinutes() ; sysSec = time.getSeconds() ; sysHrs = time.getUTCHours() ;
}

function formatedDate() {
var dateNow = new Date() ;
var yearNow = dateNow.getYear() ;
yearNow = ( yearNow < 1900 )? yearNow + 1900 : yearNow ;
monthNow = dateNow.getMonth() ;
weekdayNow = dateNow.getDay() ;
dayNow = dateNow.getDate() ;
var dayD = " " ;
dayD = ( dayNow < 10 )? "0" + dayNow : dayNow ;
var dayarray=new Array( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ) ;
var montharray=new Array( "January" ,"February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ) ;
var retDate = dayarray[ weekdayNow ] + ", " + montharray[ monthNow ] + " " + dayD + ", " + yearNow ;
return ( retDate ) ;
}

getClock() ;
sysHoff = hoursZulu - sysHrs ;
sysMoff = minZulu - sysMin ;
sysSoff = seconds - sysSec ;
if ( localTm ) {
var clientOff = sysOff + DST ;
switch ( clientOff ) {
case 0: clientZ = "London" ; break ;
case 4: clientZ = "Atlantic" ; break ;
case 5: clientZ = "Eastern" ; break ;
case 6: clientZ = "Central" ; break ;
case 7: clientZ = "Mountain" ; break ;
case 8: clientZ = "Pacific" ; break ;
default: clientZ = " " ;
}
if ( clientZ == " " ) { ; } else { if ( timeChange ) { tZone = "GMT" ; clock4 = ( DST == 0 ) ? "Standard time" : "Daylight time" ; clock4 = clock4 + " indicated for " + clientZ + " time zone " ; } else { longDate = formatedDate() ; tZone = clientZ ; offset = -1 * sysOff ; } }
}

function performReload() {
onlineState = navigator.onLine ;
if ( onlineState == 1 ) { window.location.reload() ; }
else {
if ( clock8 == ' ' ) { clock8 = clock2 ; Hide( 'footer' ) ; Show( 'altFooter' ) ; }
clock3 = "Could not connect to Internet at " + clock8 ;
clock7 = "Internet was unavailable at " + clock8 ;
checkInterval = 5 ;
}}

function tellTime() {
if ( seconds > 59 ) {
getClock() ;
if ( ( sysHoff > -2 ) && ( sysHoff < 2 ) && ( sysMoff > -60 ) && ( sysMoff < 60 ) && ( sysSoff > -60 ) && ( sysSoff < 60 ) ) {
sTemp = sysSec + sysSoff ; mTemp = sysMin + sysMoff ; hTemp = sysHrs + sysHoff ;
}
else { sTemp = 0 ; mTemp = minZulu ; hTemp = hoursZulu ; }

if ( sTemp < 0 ) { sTemp = 60 + sTemp ; mTemp = mTemp - 1 ; }
else { if ( sTemp > 59 ) { sTemp = sTemp - 60 ; mTemp = mTemp + 1 ; } }
if ( mTemp < 0 ) { hTemp = hTemp - 1 ; mTemp = 60 + mTemp ; }
else { if ( mTemp > 59 ) { hTemp = hTemp + 1 ; mTemp = 60 - mTemp ; } }
if ( hTemp < 0 ) { hTemp = 24 + hTemp ; }
else { if ( hTemp > 23 ) { hTemp = 24 - hTemp ; } }
hoursZulu = hTemp ; minZulu = mTemp ; seconds = sTemp ;
}

hrZ = ( hoursZulu < 10 ) ? "0" + hoursZulu: hoursZulu ;
if ( minZulu < 0 ) { mnZ = "00" ; } else { mnZ = ( minZulu < 10 ) ? "0" + minZulu : minZulu ; }
if ( seconds < 0 ) { sec = "00" ; } else { sec = ( seconds < 10 ) ? "0" + seconds : seconds ; }
if ( ( sec == "05" ) && ( ( mnZ % checkInterval ) == 4 ) ) { setTimeout( "performReload() ; ", 1000 ) ; }
if ( tZone == "GMT" ) { clock1 = "It's now" ; clock2 = hrZ + "." + mnZ + "." + sec + " GMT" ; clock3 = clock4 ; clock5 = clock1 + " " + clock2 ; }
else {
clock1 = hrZ + "." + mnZ + "." + sec + " GMT" ;
clock3 = offset + ( ( minOffset == 0 )? " hours" : ":" + minOffset ) + " offset from GMT " ;
hours24 = ( hoursZulu + offset ) ;
if ( minOffset > 0 ) { minutes = ( offset < 0 )? ( minZulu - minOffset ) : ( minZulu + minOffset ) ; if ( minutes > 59 ) { minutes = ( minutes - 60 ) ; hours24 = ( hours24 + 1 ) ; } else { if ( minutes < 0 ) { minutes = 60 + minutes ; hours24 = ( hours24 - 1 ) ; } } }
else { minutes = minZulu ; }
if ( ( minutes < 0 ) | ( minutes > 59 ) ) { minutes = sysMin ; clock3 = "GMT minutes " + minZulu + ", system minutes " + sysMin + ", difference " + sysMoff ; }

if ( hours24 < 0 ) { hours24 = ( 24 + hours24 ) ; }
if ( hours24 > 23 ) { hours24 = ( hours24 - 24 ) ; }
if ( hours24 == 0 ) { ampm = "am" ; hours = 12 ; tmDesc = "am " + suf ; }
else { if ( hours24 == 12 ) { ampm = "pm" ; hours = 12 ; tmDesc = "pm " + suf ; }
else { if ( hours24 > 12 ) { ampm = "pm" ; hours = ( hours24 - 12 ) ; tmDesc = "pm " + suf ; }
else { ampm="am" ; hours = hours24 ; tmDesc = "am " + suf ; }
}}

var mn = ( minutes < 10 ) ? "0" + minutes : minutes ;

clock2 = hours + ":" + mn + " " + tmDesc + tZone ;
clock5 = hours + ":" + mn + ":" + sec + " " + tmDesc + tZone ;
clock6 = hours + ":" + mn + ":" + sec + " " + ampm ;
if ( clock7 == " " ) { clock7 = suf + tZone ; }

}

if ( clock3 == ' ' ) {
if ( ( mnZ % 20 ) == 2 ) { clock3 = disclaimer ; }
if ( ( tZone != "GMT" ) && ( ( mnZ % 10 ) == 6 ) ) { clock3 = "The date for the time displayed is " + longDate ; }
if ( mnZ == 28 ) { clock3 = "Last program update: 04-02-2022" ; }
if ( mnZ == 58 ) { clock3 = "Copyright \u00A9 <?php print( gmdate( 'Y' ) ) ; ?> JustWord.net" ; }
<?php
if ( $tZ > ' ' ) { print ( 'clock3 = "'.$tZ.'" ; ' ) ; }
?>
}

setClockVariables() ;
seconds ++ ;
setTimeout( "tellTime()",1000 ) ;
}