Can someone can show me how to create time/date ticking in Codeigniter and explain that code? I am really confused right now, because started learning CI few days ago. I woud love to take date and time from server not from user PC. This is what ive done so far and stucked.
this is view file
<script>
$(document).ready(function() {
setInterval(timestamp, 1000);
});
function timestamp() {
$.ajax({
url: 'index.php',
success: function(data) {
$('#timestamp').html(data);
},
});
}
</script>
</head>
<body>
<div class = "page">
<header>
<time id="timestamp">
<?php
date_default_timezone_set('YOUR TIMEZONE');
echo date('l d F Y - H:i:s');
?>
</time>