The point in creating a subroutine to take in a date/time and return an "seconds since the epoch", is not so much for MySQL specifically, but more for portability - other databases don't have a UNIX_TIMESTAMP() function, and therefore can't give back a date/time column in "seconds since the epoch". So your subroutine can function in a date/time portability role - to convert a date/time, say coming in in YYYY-MM-DD HH:MM:SS format, into a number that is "seconds since the epoch".