-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate_time.php
50 lines (43 loc) · 998 Bytes
/
date_time.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
47
48
49
50
<?php
$time = time() + (2 * 24 * 60 * 60);
// $time = time();
echo var_dump($time);
echo "<br>";
echo date("l, d M Y", $time);
$hari = date('w');
echo "<br>" . PHP_EOL;
switch ($hari) {
case '0':
echo "Ahad";
break;
case '1':
echo "Senin";
break;
case '2':
echo "Selasa";
break;
case '3':
echo "Rabu";
break;
case '4':
echo "Kamis";
break;
case '5':
echo "Jum'at";
break;
case '6':
echo "Sabtu";
break;
default:
echo "Maaf data tidak dikenal";
break;
}
echo date(", d M Y", $time);
$bulan = date('n');
echo "<br>" . PHP_EOL;
$nama_hari = ['Ahad','Senin','Selasa','Rabu','Kamis',"Jum'at",'Sabtu'];
$nama_bulan = ['','Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember'];
echo $nama_hari[$hari];
echo date(", d ", $time);
echo $nama_bulan[$bulan];
echo date(" Y", $time);