I recommend to store your date in mysql at field timestamp because you can use default value CURRENT_TIMESTAMP - it very helpful,
and i think you shouldn't worry about it, there is a plenty of functions::
mysql:
select now();
+---------------------+
| now() |
+---------------------+
| 2015-04-08 12:13:18 |
+---------------------+
select now() - interval 1 day;
+------------------------+
| now() - interval 1 day |
+------------------------+
| 2015-04-07 12:13:29 |
+------------------------+
select now() - interval 7 day;
+------------------------+
| now() - interval 7 day |
+------------------------+
| 2015-04-01 12:13:38 |
+------------------------+
select now() - interval 1 month;
+--------------------------+
| now() - interval 1 month |
+--------------------------+
| 2015-03-08 12:13:58 |
+--------------------------+
php:
<?php
var_export([
date('Y-m-d H:i:s', strtotime('now')),
date('Y-m-d H:i:s', strtotime('- 1 day')),
date('Y-m-d H:i:s', strtotime('- 7 day')),
date('Y-m-d H:i:s', strtotime('- 1 month')),
]);
/*
Result:
array (
0 => '2015-04-08 15:15:42',
1 => '2015-04-07 15:15:42',
2 => '2015-04-01 15:15:42',
3 => '2015-03-08 15:15:42',
)
*/
And sometimes very helpful to create table like:
CREATE TABLE t1 (
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
in result your field ts will be automatically seted and updated...