Jump to content

mySQL date mktime problems!!!


emilyfrazier

Recommended Posts

Hi all,

I am still fairly new to PHP and mySQL. I have read all the tutorials on dates, yet I'm still not seeing the light today.

So I have a field in my database called 'date_joined' that holds a timestamp when a users signs up for membership. I need to make a report that tells me all the memberships that will expire within the next 30 days (memberships are for 1 year).

Is there a way to take my field and use mktime to add 1 year to it? I assume it's possible through a function that breaks up the date and then subs them in to a mktime string, but I was wondering if there is an easier way around it?

I would really appreciate any help in advance.

Thanks so much,
eef
Link to comment
https://forums.phpfreaks.com/topic/24095-mysql-date-mktime-problems/
Share on other sites

Thanks so much for the help...it doesn't work quite right. It is taking today's date if I use this code. I tried:

$yr = date('Y-m-d H:i:s', time($data['date_joined']) + (365 * 24 *60 * 60));


And it gives me today's date a year from now...I need it to take a year from now from the 'date_joined' field...thanks again

eef

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.