Page 1 of 1

Add date and time, to bottom nav-bar.

Posted: 2017-10-01 23:09
by Jay Webb
Add this to your "footer-extras.php" it will add the current Month, day and year with an active clock with hours, minutes and seconds.
To place where you want it, play with the panel location 'col-lg-3', or, trying changing navbar-fixed-bottom to navbar-fixed-center or navbar-fixed-top.

<!--begin code>

<div class-"box">
<div class="navbar-fixed-bottom hidden-print alert alert-success panel col-lg-3 text-center">
<?php echo date('F j, Y, '); ?><span id="timer"></span>
</div>
</div>
<script>
setInterval(function() {
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
var currentSeconds = currentTime.getSeconds ( );
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
document.getElementById("timer").innerHTML = currentTimeString;
}, 1000);
</script>

<!--end code-->