Created
March 24, 2017 08:49
-
-
Save Artem-Schander/c007bf715db2a2f350244b4897d26e96 to your computer and use it in GitHub Desktop.
MySQL Query to get a duration in days by two unix timestamps
This file contains 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
SELECT name, TIMESTAMPDIFF(DAY, DATE(FROM_UNIXTIME(date_start)), DATE(FROM_UNIXTIME(date_end))) + 1 AS duration | |
FROM some_table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment