带有变量的MySQL UNIX_TIMESTAMP?

Is there any way to pass a condition into UNIX_TIMESTAMP()?

eg : UNIX_TIMESTAMP(-24hr) <- this doesn't work

This returns all records that are newer than the current unix timestamp :

$sql = 'SELECT * FROM events WHERE event_date > UNIX_TIMESTAMP() ORDER BY event_date ASC';

But I would like to return all records that are newer than the current unix timestamp - 24hrs to allow for timezone differences.

Can it be done with the UNIX_TIMESTAMP() function alone?

You can try below

SELECT * FROM events 
 WHERE event_date > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 24 Hour)) ORDER BY event_date ASC

OR use shorthand version as @Madhur Bhaiya suggested

 SELECT * FROM events 
     WHERE event_date > UNIX_TIMESTAMP(NOW()- INTERVAL 24 Hour) ORDER BY event_date ASC