|Perl Monk, Perl Meditation|
What defines the output format of a Postgres Timestampby Skeeve (Parson)
|on Jan 26, 2021 at 06:41 UTC||Need Help??|
Skeeve has asked for the wisdom of the Perl Monks concerning the following question:
I'm using Mojolicious and Mojo::Pg to create an API.
When retrieving a timestamp from the database, without converting the timestamp TO_CHAR, I get something like this:
Now I'm wondering where the output format is defined.
As I would always require all timestamps to be in a RFC3339 format, I would have to change each and every select statement to have a TO_CHAR with the proper format.
There must be a more practical way of defining the format for all timestamps at a central place, but i have no clue where.
One of the answers on Stackoverflow suggests that
The display is completely controlled by the SQL client, not by the server.
The SQL client here should be DBD::Pg.
But maybe that's the wrong place to search and the conversion of a timestamp to a string representation is done at a later stage e.g. when doing the encode_json?
My current attempts in finding the spot where to change the format were fruitless :(
I hope someone here can give me more ideas where to search.