tags:

views:

38

answers:

3

I'm wanting show the Date in Japanese in this format:

2010年2月18日(木)

which translates to:

February 18, 2010 (Thu)

in PHP

can anyone help? Thanks

A: 

The easiest and most pragmatic way is probably to create a wrapper function around the date function:

function date_japan() {
  echo date('Y') . '年 ' . date('m') . '月 ' . date('d') . '日';
}
Yada
what is that actually, did you even try it?
Sarfraz
年 -> means year. 月 -> means month. 日-> means day.
Yada
The code works pretty well. Missing the day though? (thu) I'm guessing that means we'd have to have some sort of array with all the days in japanese that then get shown based on the day? $dys = array("日","月","火","水","木","金","土");
Cameron
$dy = date("w");$dys = array("日","月","火","水","木","金","土");$dyj = $dys[$dy];Is there a simpler way of adding this into the code?
Cameron
@Yada: The three can be combined to `date('Y年m月d日')`
KennyTM
+1  A: 

This Link might help you.

Obalix
+2  A: 

This is the code I have:

    function date_japan() {
    $dy  = date("w");

    $dys = array("日","月","火","水","木","金","土");
    $dyj = $dys[$dy];
      echo date('Y') . '年 ' . date('m') . '月 ' . date('d') . '日' . '(' . $dyj . ')';
    }
    date_japan();

Any improvements would be much appreciated. Thanks.

Cameron