Jump to content

PHP Date format from SQL and calculate


cjbeck71081

Recommended Posts

Ok, so i am having a bear of a time trying calculate dates.  Any help would be apprecaited.  So I am timestamping dates in SQL entries using the "INSERT INTO table (`mydate`) VALUES (CURDATE())"

 

This is populating the database with a date similar to this: 2008-09-17

 

This allows me to do a query of the database by saying "SELECT * FROM table WHERE mydate < CURDATE() - INTERVAL 30 DAY"; This part works great.. then I can send notifications to people who are past 30 days, and all are happy.

 

But now I am trying to display date information in a table for the customer to see. 

 

For example... if Bob signed up for an account he'll have a field for su_date(signup date) and it would get '2008-09-17'.  If I then wanted to make a table for a client that said... Bob signed up on 09-17-2008 and then calculate his renewel date of 30 days later... by saying Bob needs to renew by 10-17-2008.  How would i do that?

 

I have tried taking the value of mydate from the table and adding 30 to it... that just adds 30 years to the date.  I'm sure i can reorder the numbers and add form there, but what a mess.

 

Any ideas or methods would be awesome.

 

Thanks Guys

CJ

Link to comment
https://forums.phpfreaks.com/topic/124682-php-date-format-from-sql-and-calculate/
Share on other sites

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.