Code: Select all
<?php
//display today's date, time in top right of each page.
$todaydate = date('F j, Y - h:i A');
echo "$todaydate ";
?>Thanks!!!
Moderator: General Moderators
Code: Select all
<?php
//display today's date, time in top right of each page.
$todaydate = date('F j, Y - h:i A');
echo "$todaydate ";
?>Code: Select all
// JavaScript Document
function updateClock ( )
{
var currentTime = new Date();
var currentMonth = currentTime.getMonth() + 1;
var currentDay = currentTime.getDate();
var currentYear = currentTime.getFullYear();
var currentHours = currentTime.getHours();
var currentMinutes = currentTime.getMinutes();
var currentSeconds = currentTime.getSeconds();
// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = currentMonth + "/" + currentDay + "/" + currentYear + " " + currentHours + ":" + currentMinutes + " " + timeOfDay;
// Update the time display
document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}
Code: Select all
<body onload="updateClock(); setInterval('updateClock()', 1000 )">Code: Select all
var currentTime = <?php echo time(); ?>;Code: Select all
<script language="Javascript">
<!--
var hours = <? echo date('h'); ?>
var minutes = <? echo date('i'); ?>
var seconds = <? echo date('s'); ?>
function showtime ()
{
seconds = seconds + 1
if (seconds == 60)
{
seconds = 0
minutes = minutes + 1
}
if (minutes == 60)
{
minutes = 0
hours = hours + 1
}
if (hours == 24)
{
hours = 0
}
timerID = setTimeout("showtime()",1000);
currentTimeString = hours + ":" + minutes + ":" + seconds
document.getElementById("clock").innerHTML = currentTimeString
}
//-->
</script>
<body onLoad="showtime()">
<p id="clock"></p>
</body>