views:

84

answers:

2

I have a variable with a 2 digit month number.. is there a built in function that allows me to change it to the month name. I thought maybe the date() function would work, but that requires a full timestamp.

Thanks!

A: 

Not to my knowledge.

You could use:

<?php
$monate = array(
   1=>"Januar",
   2=>"Februar",
   3=>"März",
   4=>"April",
   5=>"Mai",
   6=>"Juni",
   7=>"Juli",
   8=>"August",
   9=>"September",
   10=>"Oktober",
   11=>"November",
   12=>"Dezember");
?>

<?php
$monat = date("n");
??
Acron
+3  A: 

You can use mktime with arbitrary parameters (exception of month) and then format using date (this might buy you something as far as locales).

 date('M', mktime(0, 0, 0, $month, 1, 2000));
Mark E
perfect! thanks you.
Roeland
just realized this doesnt show the full month name.. hmm
Roeland
never mind! just change the 'M' to 'F'.. cool
Roeland