Tarikh (Bahasa Melayu) [PHP]

<?php function tarikh()

{

Advertisement

$hariEng = date(‘l’);

$date = date(‘d’);

$bulan = date(‘n’);

$tahun = date(‘Y’);

$hariMalay = “”;

$bulanMalay = “”;

if($hariEng == ‘Monday’)

$hariMalay = ‘Isnin’;

else if($hariEng == ‘Tuesday’)

$hariMalay = ‘Selasa’;

else if($hariEng == ‘Wednesday’)

$hariMalay = ‘Rabu’;

else if($hariEng == ‘Thursday’)

$hariMalay = ‘Khamis’;

else if($hariEng == ‘Friday’)

$hariMalay = ‘Jumaat’;

else if($hariEng == ‘Saturday’)

$hariMalay = ‘Sabtu’;

else if($hariEng == ‘Sunday’)

$hariMalay = ‘Ahad’;

if($bulan == ‘1’)

$bulanMalay = ‘Januari’;

else if($bulan == ‘2’)

$bulanMalay = ‘Februari’;

else if($bulan == ‘3’)

$bulanMalay = ‘Mac’;

else if($bulan == ‘4’)

$bulanMalay = ‘April’;

else if($bulan == ‘5’)

$bulanMalay = ‘Mei’;

else if($bulan == ‘6’)

$bulanMalay = ‘Jun’;

else if($bulan == ‘7’)

$bulanMalay = ‘Julai’;

else if($bulan == ‘8’)

$bulanMalay = ‘Ogos’;

else if($bulan == ‘9’)

$bulanMalay = ‘September’;

else if($bulan == ’10’)

$bulanMalay = ‘Oktober’;

else if($bulan == ’11’)

$bulanMalay = ‘Nov’;

else if($bulan == ’12’)

$bulanMalay = ‘Disember’;

return $hariMalay.”, “.$date.”-“.$bulanMalay.”-“.$tahun;

}

echo tarikh();

?>

Emi

Emi atau nama sebenar Mohamad Zulhelmi berasal dari Sitiawan, Perak dan sekarang menetap di Shah Alam. Seorang programmer di sebuah organisasi yang terpaksa di rahsiakan atas sebab-sebab keselamatan. Mula aktif berblog pada akhir tahun 2008.

Leave a Reply