<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

function tgl_indo($date)
{
	$BulanIndo = array("Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember");
 
	$tahun = substr($date, 0, 4);
	$bulan = substr($date, 5, 2);
	$tgl   = substr($date, 8, 2);
 
	$result = $tgl . " " . $BulanIndo[(int)$bulan-1] . " ". $tahun;		
	return($result);
}
function nama_bulan($bulan){
    switch ($bulan) {
        case "01": $nama="Januari"; break;
        case "02": $nama="Februari"; break;
        case "03": $nama="Maret"; break;
        case "04": $nama="April"; break;
        case "05": $nama="Mei"; break;
        case "06": $nama="Juni"; break;
        case "07": $nama="Juli"; break;
        case "08": $nama="Agustus"; break;
        case "09": $nama="September"; break;
        case "10": $nama="Oktober"; break;
        case "11": $nama="November"; break;
        case "12": $nama="Desember"; break;
    }
    return $nama;   
}

function nama_hari($tanggal){
    //fungsi mencari namahari
    //format $tgl YYYY-MM-DD
    $tgl=substr($tanggal,8,2);
    $bln=substr($tanggal,5,2);
    $thn=substr($tanggal,0,4);
    $info=date('w', mktime(0,0,0,$bln,$tgl,$thn));
    switch($info){
        case '0': return "Minggu"; break;
        case '1': return "Senin"; break;
        case '2': return "Selasa"; break;
        case '3': return "Rabu"; break;
        case '4': return "Kamis"; break;
        case '5': return "Jumat"; break;
        case '6': return "Sabtu"; break;
    };
}
