postgresql - Ignoring seconds from timestamp postgres -
i running cron job every 1 minute notifying users events
select * events event_start = now() - interval '30 minutes'
so can send users notification prior 30 mins of event
problem event start timestamp field if there difference in seconds wll not work ,so how can ignore seconds part .
you can use date_trunc()
remove seconds:
select * events event_start = date_trunc('second', now()) - interval '30' minutes
more details in manual: http://www.postgresql.org/docs/current/static/functions-datetime.html#functions-datetime-trunc
Comments
Post a Comment