Hi All!
I was just reading PlanetMySQL and noticed Mike Hillyer's
recent post on a user-friendly age function for MySQL.
Basically, this function accepts two DATETIME
values
and returns an indication of the time between the two dates in
the form of a human-readable string. For example:
mysql> select TimeDiffUnits('2001-05-01', '2002-01-01')
+-------------------------------------------+
| TimeDiffUnits('2001-05-01', '2002-01-01') |
+-------------------------------------------+
| 8 Months |
+-------------------------------------------+
1 row in set (0.00 sec)
Just for fun, I decided to try and refactor it, and I'm …