|
-
Apr 24th, 2007, 06:46 PM
#1
Thread Starter
Lively Member
[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
FORZA ROSSONERI! CAMPIONI!!!
-
Apr 24th, 2007, 07:51 PM
#2
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);
?>
-
Apr 25th, 2007, 05:05 AM
#3
Thread Starter
Lively Member
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
FORZA ROSSONERI! CAMPIONI!!!
-
Apr 25th, 2007, 05:33 AM
#4
Thread Starter
Lively Member
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?
FORZA ROSSONERI! CAMPIONI!!!
-
Apr 25th, 2007, 05:35 AM
#5
Re: [RESOLVED] convert var value to month name
Just make an array of the month names
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|