mySQL date mktime problems!!!
Posted 16 October 2006 - 01:55 PM
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,
Posted 16 October 2006 - 02:12 PM
$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
Posted 16 October 2006 - 02:14 PM
$datemysqlyr = date ( "Y m d H:i:s" , strtotime ( $data [ 'date_joined' ]) + (365 * 24 *60 * 60));
Thanks very much for your help!!
Posted 16 October 2006 - 03:47 PM
<?php $datemysqlyr = date('Y m d H:i:s',strottime($data [ 'date_joined' ] . ' + 1 year')); ?>
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users