0

i am retrieving a $_GET variable date: $month= date(m, $date), is there a way to retrieve this and make it convert to its equivalent $month= date(F, $date)??
i need the variable info but i need to get the full textural representation of the month not just the number. And im hoping to do this w/o having to send an additional variable.

2
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by fuston05
0

You will need to convert to a time stamp and then convert back to what you need. First, create an arbitrary date using the month that was passed (e.g "2010-".$m."-01"). Use strtotime to convert it to a time stamp and then use Date to get the full text month.

0

Thats crazy..lol I put in "last month" and it echo'd back september.. nice

Thank you, im still working on incorporating it into my app, ill let ya know how it goes.. thank you for pointing me in the right direction.

0

ok i got it working a little.. now i set the date on index, send it to cookie php, and use strtotime and create a time stamp, and i even retriev it where i need it in my iframe. But.. i need to increment it by 1 month while in cookie, and send it (incremented) to iframe. cannot seem to figure out how to increment it +1. any ideas?

0

strtotime is pretty good at turning english into a date. Here's an example:

<?PHP
     $ts = strtotime (" next month Dec 2010 ");
     $text = date ("F",$ts);
     echo $text;
?>
0

ok, thank you very much for helping. I think i got it now. very handy function. :)

0

I got it to increment perfectly with "+1 month", however it doesn't seem to decrement the same way.

$Prevti= strtotime("-1 month", strtotime("$ti"));
if (isset($_COOKIE["ti"])){
$ti=$_COOKIE["ti"];
}

I also tried "1 month ago" ... that failed as well.

any thoughts?
Ha ha I'm sorry.. i had a cap "P" on my $prev ..thats all it was.. it's working now, ty so much for all your help. :)

Edited by fuston05: n/a

0

I got it to decrement with "strtotime("1 month ago", strtotime("$ti"));
Thanks for your help, greatly appreciated. :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.