Q:

Best practice to manage date and days

I am working on a project where I have many operations to manage.
Each operation have an end date and is composed by a certain amount of tasks.
I want to display reminders (a text displayed on the screen) if a task is not done before [end date] - X days.
All the data is stored in MySQL database and I work with PHP and HTML5.

Which datatype is (are) the best to work with date and days (to
perform calculations)?
Can I work with Date() and subtract days in a easy way?

I do not have a specific technical question, but I think sharing best way to proceed is a good thing, right?
I'm curious to know what are the best ways to proceed and open to any proposal!

A:

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

