svk
svk

Reputation: 4553

How to display after 4 week date from now?I want to pass an argument

echo date( "F jS, Y" , strtotime("now +3 weeks") );

It gives the result as July 2nd, 2010 . Fine.Now I want to pass the argument like this.

The original print_r($originalamount) give the result like this

Array ( 
      [0] => 4 Months
      [1] => 3500 
)

My code

 $text=trim($originalamount[0]);
 $text1="now +".$text;

 echo date( "F jS, Y" , strtotime($text1)) ;

The out put come like this

December 31st, 1969 

I don't know why.

alt text

Upvotes: 3

Views: 929

Answers (1)

Lizard
Lizard

Reputation: 45012

I have just tried ...

$originalamount[0] = '4 Months';

$text=trim($originalamount[0]);
$text1="now +".$text;

echo date( "F jS, Y" , strtotime($text1)) ;

And it works fine...

October 11th, 2010 

Can you please give us a var_dump of $originalamount is there any other code that might be messing with $originalamount

Upvotes: 3

Related Questions