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
Share on other sites

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.