Created
November 18, 2018 16:33
-
-
Save 333crist/8cd6704c9854fab27f139481d3101d2e to your computer and use it in GitHub Desktop.
Jam Digital di PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set("Asia/Bangkok"); | |
?> | |
<script type="text/javascript"> | |
function date_time(id) | |
{ | |
date = new Date; | |
year = date.getFullYear(); | |
month = date.getMonth(); | |
months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'Jully', 'August', 'September', 'October', 'November', 'December'); | |
d = date.getDate(); | |
day = date.getDay(); | |
days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); | |
h = date.getHours(); | |
if(h<10) | |
{ | |
h = "0"+h; | |
} | |
m = date.getMinutes(); | |
if(m<10) | |
{ | |
m = "0"+m; | |
} | |
s = date.getSeconds(); | |
if(s<10) | |
{ | |
s = "0"+s; | |
} | |
result = ''+days[day]+' '+d+' '+months[month]+' '+year+' '+h+':'+m+':'+s; | |
document.getElementById(id).innerHTML = result; | |
setTimeout('date_time("'+id+'");','1000'); | |
return true; | |
} | |
</script> | |
<span id="date_time"></span> | |
<script type="text/javascript">window.onload = date_time('date_time');</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment