Created
May 1, 2011 18:45
-
-
Save RobinStamer/950723 to your computer and use it in GitHub Desktop.
Demo of getting seconds ago from DB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mysql> SELECT time, NOW() - time as seconds_ago FROM time_test; | |
| +---------------------+-------------+ | |
| | time | seconds_ago | | |
| +---------------------+-------------+ | |
| | 2011-05-01 12:43:58 | 142 | | |
| | 2011-05-01 12:44:04 | 96 | | |
| | 2011-05-01 12:44:24 | 76 | | |
| +---------------------+-------------+ | |
| 3 rows in set (0.00 sec) | |
| -- CREATE TABLE time_test (time TIMESTAMP NOT NULL); | |
| -- INSERT INTO time_test VALUES(CURRENT_TIMESTAMP()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment