Thursday, March 18, 2010

Convert MySQL date Format to Indonesian Date Format with PHP

Below is A PHP Function to Convert MySQL date Format to Indonesian Date Format.

Example : 2010-10-10 can be 10 Oktober 2010

Below  is the Function to Convert MySQL date Format to Indonesian Date Format with PHP
javascript:void(0)


function waktuindo($datawaktu)
{
$waktu=explode('-',$datawaktu);
if ($waktu[1] == '01') //jika 01 maka januari
{
$bulan='Januari';
}
elseif ($waktu[1] == '02')
{
$bulan='Februari';
}
elseif ($waktu[1] == '03')
{
$bulan='Maret';
}
elseif ($waktu[1] == '04')
{
$bulan='April';
}
elseif ($waktu[1] == '05')
{
$bulan='Mei';
}
elseif ($waktu[1] == '06')
{
$bulan='Juni';
}
elseif ($waktu[1] == '07')
{
$bulan='Juli';
}
elseif ($waktu[1] == '08')
{
$bulan='Agustus';
}
elseif ($waktu[1] == '09')
{
$bulan='September';
}
elseif ($waktu[1] == '10')
{
$bulan='Oktober';
}
elseif ($waktu[1] == '11')
{
$bulan='November';
}
elseif ($waktu[1] == '12')
{
$bulan='Desember';
}
else
{
$bulan='00';
}
echo"$waktu[2] $bulan $waktu[0]";
}



It was a simple fuction to Convert MySQL date Format to Indonesian Date Format with PHP by myself Maybe need a correction for perfection.

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Sweet Tomatoes Printable Coupons