-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtime_countdown.php
46 lines (38 loc) · 1.01 KB
/
time_countdown.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
date_default_timezone_set('Asia/Jakarta');
//now
$now = time();
//event
$hour = 10;
$minute =12;
$second =0;
$month =date('m');
$day= date('d');
$year =date('Y');
$evant = mktime($hour, $minute, $second, $month, $day, $year);
//countdown
$countdown = round(($evant - $now));
echo "Date : ". date('d-m-Y') .'<br>';
echo "Time : ". time() .'<br>';
echo "Now : ". $now.'<br>';
echo "Event : ". $evant.'<br>';
print_r($countdown);
?>
<html>
<head>
<script type="text/javascript">
var secondLeft = <?= $countdown ?>
if(secondLeft <= 0){
//alert('Time Out!');
}
//function calltimer(){
// document.getElementById("time").innerHTML = secondLeft -= 1;
//setTimeout(calltimer, 1000);
//}
</script>
</head>
<body onload="calltimer()">
<div id="time">waktu</div>
<a href="./fuck.php">link</a>
</body>
</html>