postgresql ignore milliseconds from timestamp when doing a select statement -
i have tablea , has field of time_captured | timestamp without time zone | default now() being used record when data inserted table. however, trying select , ignore milliseconds. instead of having
2015-07-11 18:06:33.690498 2015-07-12 13:36:21.274509 2015-07-12 13:36:24.222577 2015-07-12 13:36:26.515593
i have
2015-07-11 18:06:33 2015-07-12 13:36:21 2015-07-12 13:36:24 2015-07-12 13:36:26
having microseconds in table needed not need output show microseconds. how can ? closest have come using following not able figure out how pull full date time shown above.
select extract(year time_captured @ time zone 'utc') server_perf; date_part
thank :)
you can use date_trunc function achieve this:
select date_trunc('second', time_captured) server_perf;
see http://www.postgresql.org/docs/9.1/static/functions-datetime.html#functions-datetime-trunc more on this.
Comments
Post a Comment