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