<?php
function hari()
{
$hari2=date("w");
Switch ($hari2){
case 0 : $hari="Minggu";
Break;
case 1 : $hari="Senin";
Break;
case 2 : $hari="Selasa";
Break;
case 3 : $hari="Rabu";
Break;
case 4 : $hari="Kamis";
Break;
case 5 : $hari="Jumat";
Break;
case 6 : $hari="Sabtu";
Break;
}
return $hari;
}

	function tgl_indo($tgl){ // dd/mm/yyyy ke yyyy-mm-dd
			$tanggal = substr($tgl,8,2);
			$bulan = getBulan(substr($tgl,5,2));
			$tahun = substr($tgl,0,4);
			return $tanggal.'/'.$bulan.'/'.$tahun;		 
	}

	function tgl_print($tgl){ // dd/mm/yyyy ke yyyy-mm-dd
			$tanggal = substr($tgl,8,2);
			$bulan = Bulan(substr($tgl,5,2));
			$tahun = substr($tgl,0,4);
			return $tanggal.' '.$bulan.' '.$tahun;		 
	}

	function tgl_pesan($tgl){
			$tanggal = substr($tgl,0,2);
			$bulan = getBulan(substr($tgl,4,3));
			$tahun = substr($tgl,6,9);
			return $tahun.'-'.$bulan.'-'.$tanggal;		 
	}
	
	function tgl_kas($tgl){
			$tanggal = substr($tgl,0,2);
			$bulan = getBulan(substr($tgl,3,4));
			$tahun = substr($tgl,6,9);
			return $tahun.'-'.$bulan.'-'.$tanggal;		 
	}

	function tgl_standard($tgl){ // yyyy-mm-dd ke dd/mm/yyyy
			$tanggal = substr($tgl,0,2);
			$bulan = getBulan(substr($tgl,3,4));
			$tahun = substr($tgl,6,9);
			return $tahun.'-'.$bulan.'-'.$tanggal;		 
	}
	
		function filter_bulan($tgl){
			$bulan = getBulan(substr($tgl,5,2));
			return $bulan;		 	 
	}
		function filter_tahun($tgl){
			$tahun = substr($tgl,0,4);
			return $tahun;		 	 
	}

	function getBulan($bln){
				switch ($bln){
					case 1: 
						return "01";
						break;
					case 2:
						return "02";
						break;
					case 3:
						return "03";
						break;
					case 4:
						return "04";
						break;
					case 5:
						return "05";
						break;
					case 6:
						return "06";
						break;
					case 7:
						return "07";
						break;
					case 8:
						return "08";
						break;
					case 9:
						return "09";
						break;
					case 10:
						return "10";
						break;
					case 11:
						return "11";
						break;
					case 12:
						return "12";
						break;
				}
			} 
			
			function Bulan($bln){
				switch ($bln){
					case 1: 
						return "Januari";
						break;
					case 2:
						return "Februari";
						break;
					case 3:
						return "Maret";
						break;
					case 4:
						return "April";
						break;
					case 5:
						return "Mei";
						break;
					case 6:
						return "Juni";
						break;
					case 7:
						return "Juli";
						break;
					case 8:
						return "Agustus";
						break;
					case 9:
						return "September";
						break;
					case 10:
						return "Oktober";
						break;
					case 11:
						return "November";
						break;
					case 12:
						return "Desember";
						break;
				}
			} 
?>
