Untuk rekan-rekan yang ingin mengubah tanggal pada jcow dengan tanggal format Indonesia
dapat melakukan update pada script get_date yang terdapat dalam file
common.inc.php. Namun jika anda menggunakan script ini tidak dapat (
belum ketemu scriptnya ) menampilkan Today ( hari ini ) Yesterday (
kemarin ). Dan perlu diketahui juga dengan update fungsi get _date maka
script setting pada file config tidak difungsikan lagi. Mungkin ada
rekan-rekan yang mau membantu mengupdate script dibawah ini sehingga
lebih sempurna.
Langkah - langkah penggantian script
buka folder dan buka file : INCLUDES/LIBS/COMMON.INC.PHP
Find / Cari script :
/*
function get_date($timeline, $type = 'time') {
GLOBAL $settings, $client;
$timeline = $timeline + $client['timezone']*3600;
$current = time() + $client['timezone']*3600;
$it_s = intval($current - $timeline);
$it_m = intval($it_s/60);
$it_h = intval($it_m/60);
$it_d = intval($it_h/24);
$it_y = intval($it_d/365);
if ($type == 'date'){
return gmdate($settings['date_format'],$timeline);
}
else {
if(gmdate("j",$timeline) == gmdate("j",$current)) {
return $settings['date_today'].', '.gmdate($settings['time_format'],$timeline);
}
elseif(gmdate("j",$timeline) == gmdate("j",($current-3600*24) ) ) {
return $settings['date_yesterday'].', '.gmdate($settings['time_format'],$timeline);
}
return gmdate($settings['date_format'].', '.$settings['time_format'],$timeline);
}
}
*/
Dan replace / timpa dengan kode :
function get_date ($timestamp = '', $date_format = 'l, j F Y | H:i:s', $suffix = 'WIB') {
if (trim ($timestamp) == '')
{
$timestamp = time ();
}
elseif (!ctype_digit ($timestamp))
{
$timestamp = strtotime ($timestamp);
}
# remove S (st,nd,rd,th) there are no such things in indonesia :p
$date_format = preg_replace ("/S/", "", $date_format);
$pattern = array (
'/Mon[^day]/','/Tue[^sday]/','/Wed[^nesday]/','/Thu[^rsday]/',
'/Fri[^day]/','/Sat[^urday]/','/Sun[^day]/','/Monday/','/Tuesday/',
'/Wednesday/','/Thursday/','/Friday/','/Saturday/','/Sunday/',
'/Jan[^uary]/','/Feb[^ruary]/','/Mar[^ch]/','/Apr[^il]/','/May/',
'/Jun[^e]/','/Jul[^y]/','/Aug[^ust]/','/Sep[^tember]/','/Oct[^ober]/',
'/Nov[^ember]/','/Dec[^ember]/','/January/','/February/','/March/',
'/April/','/June/','/July/','/August/','/September/','/October/',
'/November/','/December/',
);
$replace = array ( 'Sen','Sel','Rab','Kam','Jum','Sab','Min',
'Senin','Selasa','Rabu','Kamis','Jumat','Sabtu','Minggu',
'Jan','Feb','Mar','Apr','Mei','Jun','Jul','Ags','Sep','Okt','Nov','Des',
'Januari','Februari','Maret','April','Juni','Juli','Agustus','Sepember',
'Oktober','November','Desember',
);
$date = date ($date_format, $timestamp);
$date = preg_replace ($pattern, $replace, $date);
$date = ($suffix)?"{$date} {$suffix}":"{$date}";
return $date;
}
Langkah - langkah penggantian script
buka folder dan buka file : INCLUDES/LIBS/COMMON.INC.PHP
Find / Cari script :
/*
function get_date($timeline, $type = 'time') {
GLOBAL $settings, $client;
$timeline = $timeline + $client['timezone']*3600;
$current = time() + $client['timezone']*3600;
$it_s = intval($current - $timeline);
$it_m = intval($it_s/60);
$it_h = intval($it_m/60);
$it_d = intval($it_h/24);
$it_y = intval($it_d/365);
if ($type == 'date'){
return gmdate($settings['date_format'],$timeline);
}
else {
if(gmdate("j",$timeline) == gmdate("j",$current)) {
return $settings['date_today'].', '.gmdate($settings['time_format'],$timeline);
}
elseif(gmdate("j",$timeline) == gmdate("j",($current-3600*24) ) ) {
return $settings['date_yesterday'].', '.gmdate($settings['time_format'],$timeline);
}
return gmdate($settings['date_format'].', '.$settings['time_format'],$timeline);
}
}
*/
Dan replace / timpa dengan kode :
function get_date ($timestamp = '', $date_format = 'l, j F Y | H:i:s', $suffix = 'WIB') {
if (trim ($timestamp) == '')
{
$timestamp = time ();
}
elseif (!ctype_digit ($timestamp))
{
$timestamp = strtotime ($timestamp);
}
# remove S (st,nd,rd,th) there are no such things in indonesia :p
$date_format = preg_replace ("/S/", "", $date_format);
$pattern = array (
'/Mon[^day]/','/Tue[^sday]/','/Wed[^nesday]/','/Thu[^rsday]/',
'/Fri[^day]/','/Sat[^urday]/','/Sun[^day]/','/Monday/','/Tuesday/',
'/Wednesday/','/Thursday/','/Friday/','/Saturday/','/Sunday/',
'/Jan[^uary]/','/Feb[^ruary]/','/Mar[^ch]/','/Apr[^il]/','/May/',
'/Jun[^e]/','/Jul[^y]/','/Aug[^ust]/','/Sep[^tember]/','/Oct[^ober]/',
'/Nov[^ember]/','/Dec[^ember]/','/January/','/February/','/March/',
'/April/','/June/','/July/','/August/','/September/','/October/',
'/November/','/December/',
);
$replace = array ( 'Sen','Sel','Rab','Kam','Jum','Sab','Min',
'Senin','Selasa','Rabu','Kamis','Jumat','Sabtu','Minggu',
'Jan','Feb','Mar','Apr','Mei','Jun','Jul','Ags','Sep','Okt','Nov','Des',
'Januari','Februari','Maret','April','Juni','Juli','Agustus','Sepember',
'Oktober','November','Desember',
);
$date = date ($date_format, $timestamp);
$date = preg_replace ($pattern, $replace, $date);
$date = ($suffix)?"{$date} {$suffix}":"{$date}";
return $date;
}
0 komentar:
Posting Komentar