Add 30 Days For Date In Db
I have publish up date and publish down date in my DB. Currently they are both same dates. How do I change it (during mysql insert) so publish down date is 30 days past publish up
Solution 1:
You can use DATE_ADD():
DATE_ADD(my_date, INTERVAL 30 DAY)
Solution 2:
in php, before inserting you can use strtotime(): if the publishDown date is a timestamp:
$publishDown = strtotime("+30 days",$publishDown);
otherwise you may have to use mktime to get it in the right format
Post a Comment for "Add 30 Days For Date In Db"