MySQL: CAST + SUBSTR vs. FLOOR + MOD I have a field  in a mysql database where dates are stored as BIGINT like YYYYMMDDHHMMSS (PHP: date('YmdHis')). I'm building a query, where I check the amount of rows per hour and have tried two different things:

SELECT x hour, ... FROM table WHERE ... GROUP BY x ...


x = SUBSTR(CAST(time AS CHAR(14)), 9, 2)
x = MOD(FLOOR(time / 10000), 100)


I built a quick benchmark (did 1000 querys with each version) and both of them seem to be equally quick so I'm really interested in what database designers would advise me to do?
Database designers would definitely advise you to use proper data format and built-in date calculation functions