[RESOLVED] convert var value to month name
how do I get this: $loop['month'] (contains a number betwen 1 & 12) to the actual name? ex Jan or Apr. As it's now it only returns the number
Oh bye the way. I'm using it in an echo.
Code:
echo "This month is called", $loop['month'];
I guess I should use the Date thingy but how?
thanks
Re: convert var value to month name
make a fake date out of it, and then use date() to return the month.
PHP Code:
<?php
$t = mktime(, , , $loop['month'], 1);
echo 'This month is ' . date('F', $t);
?>
Re: convert var value to month name
worked like a charm but I had to replace all the , , , in mktime with nothing. like this:
Code:
$t = mktime($loop['month'], 1);
anyway. thanks alot kows
Re: [RESOLVED] convert var value to month name
hehe :) did I mention I' am noob at php? ofcourse i could'nt remove the ,,,
this is what I use now and it works
Code:
$t = mktime(1,1,1, $loop['month'], 1);
just a question. With this code
Code:
$t = mktime($loop['month'], 1);
the month was returnt to me in swedish. Now it's in english. Why and can I make it swedish again?
Re: [RESOLVED] convert var value to month name
Just make an array of the month names