Forum Moderators: coopster

Message Too Old, No Replies

date: %M to %m

         

cdmn

2:14 pm on Apr 4, 2007 (gmt 0)

10+ Year Member



Hi there,

sounds stupid but i cant find any solution to this problem.

I have month, lets say April, is there any function which will return 04?

justageek

2:19 pm on Apr 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I looked for one a long time ago and couldn't find one. I ended up just building an array with the months and added it to my include file. Been using it ever since.

JAG

mcibor

2:21 pm on Apr 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yes, it's called switch or array :)

$month = array('01'=>'January', '02'=>'February', '03'=>'March', '04'=>'April');//...

$Month = array_flip($month);
$date = 'April';
$date00 = $Month[$date];

Regards
Michal

coopster

2:27 pm on Apr 4, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



$month = strftime [php.net]('%m', strtotime [php.net]('April 1'));

cdmn

11:02 am on Apr 5, 2007 (gmt 0)

10+ Year Member



coopster, you are the man :)