In Postgres, is it possible to change the default format mask for a timestamp?
Right now comes back as:
2012-01-03 20:27:53.611489
I would like resolution to minute like this:
2012-01-03 20:27
I know I can do this on individual columns with to_char() as or stripped down with a substr() by the receiving app, but having it formatted correctly initially would save a lot of work and reduce a lot of errors.
In postgres, you can change the default format mask for datetimes – using the
set datestyleoption; the available options can be found here (see 8.5.2. Date/Time Output).Unfortunately, all the available options include the number of seconds – you will therefore need to reformat them either in the query or the application code (if applicable).