(root@33306) [(none)]> select sysdate();
+---------------------+
| sysdate() |
+---------------------+
| 2018-09-28 16:27:50 |
+---------------------+
1 row in set (0.00 sec)
(root@33306) [(none)]> select date_format(now(), '%Y-%m-%d');
+--------------------------------+
| date_format(now(), '%Y-%m-%d') |
+--------------------------------+
| 2018-09-28 |
+--------------------------------+
1 row in set (0.00 sec)
(root@33306) [(none)]> select unix_timestamp(now());
+-----------------------+
| unix_timestamp(now()) |
+-----------------------+
| 1538123541 |
+-----------------------+
1 row in set (0.00 sec)
(root@33306) [(none)]> select str_to_date('2016-01-02', '%Y-%m-%d %H');
+------------------------------------------+
| str_to_date('2016-01-02', '%Y-%m-%d %H') |
+------------------------------------------+
| 2016-01-02 00:00:00 |
+------------------------------------------+
1 row in set (0.02 sec)
(root@33306) [(none)]> select unix_timestamp('2016-01-02');
+------------------------------+
| unix_timestamp('2016-01-02') |
+------------------------------+
| 1451664000 |
+------------------------------+
1 row in set (0.00 sec)
(root@33306) [(none)]> select from_unixtime(1451997924);
+---------------------------+
| from_unixtime(1451997924) |
+---------------------------+
| 2016-01-05 20:45:24 |
+---------------------------+
1 row in set (0.00 sec)
(root@33306) [(none)]> select from_unixtime(1451997924,'%Y-%d');
+-----------------------------------+
| from_unixtime(1451997924,'%Y-%d') |
+-----------------------------------+
| 2016-05 |
+-----------------------------------+
1 row in set (0.00 sec)