SHARE
TWEET

PHP Convert Date Indonesia

Bedhoel Apr 18th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //example : get_date_indonesia('2018-03-30 12:04:53');
  2.     function get_date_indonesia($date){   //Only format yyyy-mm-dd  
  3.         $BulanIndo = array("Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember");
  4.      
  5.         $tahun = substr($date, 0, 4);
  6.         $bulan = substr($date, 5, 2);
  7.         $tgl   = substr($date, 8, 2);
  8.         $time  = substr($date, 10, 10);
  9.    
  10.         $result = $tgl . " " . $BulanIndo[(int)$bulan-1] . " ". $tahun.$time;  
  11.        
  12.         return($result);
  13.     }
  14.  
  15. echo get_date_indonesia('2019-04-18 12:04:53');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top