Jump to content

Recommended Posts

Hello

 

im a bit stuck again...

 

Any ideas on how can add a variable number of days (retrieved from database) to a date (also retrieved from database) to give a new date and then output the new date value????

 

 

e.g.  Both queries i have already retrieve and output the number of days and the SowDate.

 

84  2009-07-01

 

 

<?php echo $row_newtest['LifeTime'];?>
  <?php echo $row_test['SowDate']; ?>

 

 

I just need to add the days to the sowdate to give my new date...(which later is inserted a db.)

 

Any help would be be ace!

 

Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/164856-solved-add-days-to-a-date/
Share on other sites

This is why you should work with unix timestamps in the database, and only show the dates in readable form when outputted to the browser.

 

Save your dates in the unix format, using php time(); for instance. Then add the number of seconds required, I.e.

 

86400 for one day.

604800 for one weak.

2629743 for one month.

31556926 for one year.

63113852 for two years.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.