date - MySQL compare unix timestamps -


i'm trying records have date_created within 2 hours ago. it's unix timestamp created php function time(). here current query:

select id gsapi_synsets name = "beyonce" , date_created between  unix_timestamp(date_created) , unix_timestamp(date_add(curdate(),interval 2 hour))     

doesn't seem working though.

if none of date_created values in future, can use this:

select id gsapi_synsets name = 'beyonce'   , date_created > unix_timestamp(now() - interval 2 hour); 

if date_created values can in future, use this, cuts off @ current

select id gsapi_synsets name = 'beyonce'   , date_created between unix_timestamp(now() - interval 2 hour) , unix_timestamp() 

note calling unix_timestamp without argument returns timestamp "right now".


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -