Created
November 12, 2015 06:56
-
-
Save dwihujianto/f74151944f54872cba3f to your computer and use it in GitHub Desktop.
Helper tanggal indonesia (Codeigniter 3.03)
This file contains hidden or 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 defined('BASEPATH') OR exit('Forbbiden'); | |
if (! function_exists('indodate')) | |
{ | |
function indodate($date='') | |
{ | |
$Arrmonth = [ | |
1 => 'Januari', | |
2 => 'Februari', | |
3 => 'Maret', | |
4 => 'April', | |
5 => 'Mei', | |
6 => 'Juni', | |
7 => 'Juli', | |
8 => 'Agustus', | |
9 => 'September', | |
10 => 'Oktober', | |
11 => 'November', | |
12 => 'Desember' | |
]; | |
$olddate = explode('-', $date); | |
$year = $olddate[0]; | |
$month = $Arrmonth[$olddate[1]]; | |
$day = $olddate[2]; | |
$newdate = $day.' '.$month.' '.$year; | |
return $newdate; | |
} | |
} | |
if (! function_exists('indodatetime')) | |
{ | |
function indodatetime($data) | |
{ | |
$Arrmonth = [1=>'Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember']; | |
$origin = explode('-', $data); | |
$year = $origin[0]; | |
$month = $Arrmonth[$origin[1]]; | |
$originday = explode(' ', $origin[2]); | |
$day = $originday[0]; | |
$newdatetime = $originday[1].' '.$day.' '.$month.' '.$year; | |
return $newdatetime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment