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.

Recommended Answers

All 7 Replies

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.

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.

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?

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;
?>

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

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. :)

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.