0

I can showing month and day in php, from this documentation http://php.net/manual/en/function.date.php

for example

Wednesday, 03 March 2012

i want to change it into my language

Rabu, 03 Maret 2012

or it is best if can like this

Rabu, 3 Maret 2012

i am using whm and cpanel, cant found options to translate this, maybe i need to edit some files in PHP configuration, but which one, please help guys

if wrong category, please moved it

Edited by basketmen

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by cereal
0

You can use str_replace() for days of week and months.


<?php $days_of_week_no = range(0,6); $days_of_week_translated = array( 'Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu' ); $months_no = range(1,12); $months_translated = array( 'Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'Desember' ); $week_day = str_replace($days_of_week_no, $days_of_week_translated, date('w')); $month = str_replace($months_no, $months_translated, date('n')); echo $week_day . ' ' . date('d') . ' ' . $month . ' ' . date('Y'); ?>

Bye :)

Edited by cereal: moved Minggu (Sunday) to the top of the array

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.