Search code examples
mysqlbetweenepoch

MySQL epoch time between two column epochs


Sorry if this has been asked but can't find anything. I have a table that has two epoch timestamps (one is start of a session, other is end of a session), I want to find if a variable is in between column x and column y. I've used between to see if a column is between two variables but can't really think of the syntax for the other way.

Cheers for any help


Solution

  • BETWEEN should work for timestamps. However, there are a handful of other date functions in MySQL that should be helpful. Check out UNIX_TIMESTAMP()