<?php

if (!function_exists('tglbulanindo')) {
    function tglbulanindo($waktu, $tipe = '')
    {
        $detik = substr($waktu, 17, 2);
        $menit = substr($waktu, 14, 2);
        $jam = substr($waktu, 11, 2);
        $tgl = substr($waktu, 8, 2);
        $bln = substr($waktu, 5, 2);
        $thn = substr($waktu, 0, 4);
        $bulan = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'];
        $idxhari = date('N', strtotime($waktu));

        switch ($tipe) {
            case 1:
                $full = $tgl.' '.$bulan[(int) $bln - 1].' '.$thn;
                break;
            case 2:
                $full = $tgl.'/'.$bln.'/'.$thn;
                break;
            case 3:
                $full = $tgl.'/'.$bln.'/'.$thn.' '.$jam.':'.$menit.':'.$detik;
                break;
            case 4:
                $full = $tgl.' '.$bulan[(int) $bln - 1].' '.$thn.' '.$jam.':'.$menit;
                break;
            default:
                $full = "$tgl ".$bulan[(int) $bln - 1]." $thn";
        }

        return $full;
    }
}