<?php
$tanggal = "2015-07-01"; //tgl yg akan di cari nama harinya
$query ="SELECT datediff('$tanggal',CURDATE()) AS selisih"; $data=mysql_query($query);
@$baca=mysql_fetch_array($data);
$selisih= $baca['selisih'];
$x = mktime (0 ,0 ,0 ,date("m") , date("d") +$selisih, date("y"));
echo date ("l" , $x );
?>
Indonesia
<?php
$tanggal
= "2015-07-0";
$query ="SELECT
datediff('$tanggal',CURDATE()) AS selisih";
$data=mysql_query($query);
@$baca=mysql_fetch_array($data);
$selisih = $baca['selisih'];
$x = mktime (0 ,0 ,0 ,date("m") ,
date("d") +$selisih, date("y"));
$nama_hari= date("l", $x);
//huruf depan haruslah besat
if ($nama_hari == "Sunday")
$nama_hari ="minggu";
elseif ($nama_hari == "Monday"
)$nama_hari ="senin";
elseif ($nama_hari == "Tuesday" )
$nama_hari ="selasa";
elseif ($nama_hari == "Wednesday"
) $nama_hari ="rabu";
elseif ($nama_hari == "Thursday"
) $nama_hari ="kamis";
elseif ($nama_hari == "Friday" )
$nama_hari ="jumat";
elseif ($nama_hari == "Satruday"
)$nama_hari ="sabtu";
echo"Pada tanggal $tanggal adalah hari
<b>$nama_hari</b>";
Tidak ada komentar:
Posting Komentar