Forum Moderators: coopster

Message Too Old, No Replies

Translate month with PHP

         

Jim123

7:32 am on Jul 9, 2010 (gmt 0)

10+ Year Member



I am trying to translate the current month into another language with php. It is part of WordPress, month of posting the post.

I have tried this, but it doesn't work

<?php $mnth = the_time('M');
if ($mnth = 'Mar') $imnth = 'Mrt';
if ($mnth = 'May') $imnth = 'Mei';
if ($mnth = 'Oct') $imnth = 'Okt';
?>
<p class="date">
<span class="month"><?php $imnth; ?></span>


I have no clue how to solve it because I don't know much about PHP. It shouldn't be too difficult though.

Can someone help me with this?
Thanks

Readie

8:01 am on Jul 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the_time

I'm not even sure this is a PHP function.

Anyways, try this:
<?php

$mnth = date('M');
switch(strtolower($mnth)) {
case 'mar':
$mnth = 'Mrt';
break;
case 'may':
$mnth = 'Mei';
break;
case 'oct':
$mnth = 'Okt';
break;
}

?><p class="date">
<span class="month"><?php echo $mnth; ?></span>
</p>