driz Posted December 30, 2008 Share Posted December 30, 2008 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 More sharing options...
Wander Posted December 30, 2008 Share Posted December 30, 2008 what exactly is $roku or $strroku meant to be? Link to comment Share on other sites More sharing options...
driz Posted December 31, 2008 Author Share Posted December 31, 2008 Ignore all the code in that above post, that was just an example I tried ages ago! My basic plan is to create this format: 2008年12月31日(水)Thanks. x Link to comment Share on other sites More sharing options...
Wander Posted December 31, 2008 Share Posted December 31, 2008 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 More sharing options...
driz Posted December 31, 2008 Author Share Posted December 31, 2008 (水) is $DYJ in this:$fyr = date("Y");$mn = date("n") + 1;$dt = date("j");$dy = date("w");$dys = array("日","月","火","水","木","金","土");$dyj = $dys[$dy]; Link to comment Share on other sites More sharing options...
driz Posted December 31, 2008 Author Share Posted December 31, 2008 MSN Japan has it at the top: http://jp.msn.com/ If someone knows how to replicate that exactly using PHP that would be awesome. x Link to comment Share on other sites More sharing options...
Wander Posted December 31, 2008 Share Posted December 31, 2008 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 More sharing options...
driz Posted December 31, 2008 Author Share Posted December 31, 2008 I don't actually know because the they dont mean anything on their own! If you look at the 12, it disappears in the translation, so it works with one of the symbols. Link to comment Share on other sites More sharing options...
Wander Posted December 31, 2008 Share Posted December 31, 2008 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 More sharing options...
driz Posted December 31, 2008 Author Share Posted December 31, 2008 It looks good at the moment pal, I'll test run it out over a couple of days and see if it holds up what. Cheers. x Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.