Last active
April 22, 2020 00:14
-
-
Save ardianta/ba0934a0ee88315359d30095c7e442de to your computer and use it in GitHub Desktop.
Helper CodeIgniter untuk membuat tanggal dalam format bahasa indonesia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Helpher untuk mencetak tanggal dalam format bahasa indonesia | |
* | |
* @package CodeIgniter | |
* @category Helpers | |
* @author Ardianta Pargo (ardianta_pargo@yhaoo.co.id) | |
* @link https://gist.github.com/ardianta/ba0934a0ee88315359d30095c7e442de | |
* @version 1.0 | |
*/ | |
/** | |
* Fungsi untuk merubah bulan bahasa inggris menjadi bahasa indonesia | |
* @param int nomer bulan, Date('m') | |
* @return string nama bulan dalam bahasa indonesia | |
*/ | |
if (!function_exists('bulan')) { | |
function bulan(){ | |
$bulan = Date('m'); | |
switch ($bulan) { | |
case 1: | |
$bulan = "Januari"; | |
break; | |
case 2: | |
$bulan = "Februari"; | |
break; | |
case 3: | |
$bulan = "Maret"; | |
break; | |
case 4: | |
$bulan = "April"; | |
break; | |
case 5: | |
$bulan = "Mei"; | |
break; | |
case 6: | |
$bulan = "Juni"; | |
break; | |
case 7: | |
$bulan = "Juli"; | |
break; | |
case 8: | |
$bulan = "Agustus"; | |
break; | |
case 9: | |
$bulan = "September"; | |
break; | |
case 10: | |
$bulan = "Oktober"; | |
break; | |
case 11: | |
$bulan = "November"; | |
break; | |
case 12: | |
$bulan = "Desember"; | |
break; | |
default: | |
$bulan = Date('F'); | |
break; | |
} | |
return $bulan; | |
} | |
} | |
/** | |
* Fungsi untuk membuat tanggal dalam format bahasa indonesia | |
* @param void | |
* @return string format tanggal sekarang (contoh: 22 Desember 2016) | |
*/ | |
if (!function_exists('tanggal')) { | |
function tanggal() { | |
$tanggal = Date('d') . " " .bulan(). " ".Date('Y'); | |
return $tanggal; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment