Jump to content

Japan Date Using Php


driz

Recommended Posts

Hi I'm wanting to show the date in Japanese in this format: 2008年12月31日(水) which translates to: Wednesday, December 31, 2008I take it I would display the japanese symbols in an array? I have been playing around with this, but it keeps messing up. Can anyone help?This is what I came up with a while ago:

$fyr  = date("Y");$mn  = date("n") + 1;$dt  = date("j");$dy  = date("w");$dys = array("日","月","火","水","木","金","土");$dyj = $dys[$dy];$roku = ($mn + 5) % 6; //I think this formula works$dt2 = $dt + $roku;$dt2 = $dt2 - 6;while($dt2 > 6) $dt2 = $dt2 - 6;$roku = $dt2;$strroku = array("先勝", "友引", "先負", "仏滅", "大安", "赤口");$strroku = $strroku[$roku - 1]; $roku = round($dt/2);$msg = "$mn 月 $dt 日 ($dyj) $strroku";echo $msg;

Link to comment
Share on other sites

well im not japanese so im not entirely sure how the format works, but isnt the start something like this?<?php $days = array('日','月','火','水','木','金','土'); $msg = date('Y').'年'.date('n').$days[date('w')].date('j').'日';?>but i dunno what the '(水)' at the end means

Link to comment
Share on other sites

in this format: 2008年12月31日(水)which symbols are variable? only the 水? (which is the day-name then?), so 月 are both 'month' and 'monday' and 日 are both 'day' and 'sunday'?$days = array('日','月','火','水','木','金','土');$msg = date('Y').'年'.date('n').'月'.date('j').'日('.$days[date('w')].')';

Link to comment
Share on other sites

if id guess 2008年12月31日(水) means 2008th year, 12th month, 31st day, (wednesday)the code i posted above would work right then i guess, unless things change on different days

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...