The number of seconds between dates that lie two weeks apart can be computed like this:
mysql>
mysql> SET @dt1 = '1984-01-01 09:00:00';
Query OK, 0 rows affected (0.00 sec)
mysql> SET @dt2 = '1984-01-15 09:00:00';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT UNIX_TIMESTAMP(@dt2) - UNIX_TIMESTAMP(@dt1) AS seconds;
+---------+
| seconds |
+---------+
| 1209600 |
+---------+
1 row in set (0.00 sec)
mysql>
Related examples in the same category