mercredi 7 janvier 2015

How can I always get Timestamp in certain format without having to explicitly define it everytime


When I run a select on a timestamp I get something like: 2015-01-02T23:22:36.000Z, 1/7/2015 11:03:31 AM


in order to format properly I have to do:


SELECT to_char(entered, 'MM/DD/YYYY HH12:MI:SS AM') FROM analytics WHERE business_id = 371746;


which is kind of a pain, since I often just do SELECT * and don't specify the fields.


Is there a way to tell Postgres to always return this kind of format 'MM/DD/YYYY HH12:MI:SS AM' froma SELECT without having to specify it everytime?


Thanks for reading,


Sean.





Aucun commentaire:

Enregistrer un commentaire