Jump to content

Adding Dates from a database


Andrew R

Recommended Posts

Hi

 

The below script pulls a date from the database depending on what user is selected and then adds on 14 days (2 weeks).  The problem is the script is not giving me the desired output.  Any ideas? 

 

Cheers

 

<?  $date =  $row_thing['date'];


						$nxt = date('$date', strtotime('+14 days'));



						echo $nxt;


						?>

Link to comment
https://forums.phpfreaks.com/topic/49365-adding-dates-from-a-database/
Share on other sites

Hmmm....I have the same exact line in one of my scripts, the only difference is I have the +14 days in double quotes and it works fine. Maybe give that a try? I doubt it makes a difference, but it's worth a go. Oh, maybe your variable needs to be in double quotes as well.

 

$nxt = date("$date", strtotime("+14 days"));

Hmmm....I have the same exact line in one of my scripts, the only difference is I have the +14 days in double quotes and it works fine. Maybe give that a try? I doubt it makes a difference, but it's worth a go. Oh, maybe your variable needs to be in double quotes as well.

 

$nxt = date("$date", strtotime("+14 days"));

 

It's working now but its not adding on the 14 days.  Just echoing the date from the database?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.