Hi All,
I am not sure how to change the date format in PostgreSQL. I have the dates stored in the database as
. But I want these dates to be shown in the following format:
So now while I am trying to fetch the dates from the database I am using to_char() as below:
In this way I am able to get the required format but the problem I am facing is when I am trying to use this information then I think it is treating the dates as characters so I am not able to get required result.
For Ex: When I am trying to sort the output records with the dates then it is not sorting properly.
So can anybody give some idea or example how to do this in other way and get rid of my issue.
Thanks and Regards,
Chittaranjan :)
I am not sure how to change the date format in PostgreSQL. I have the dates stored in the database as
Code:
yyyy-mm-dd HH:MM:SS+TimeZone to get the GMT time (Ex: 2008-02-28 14:03:23+05:30)
Code:
dd/mm/yyyy HH:MM:SS TimeZone (Ex: 28/02/2008 14:03:23 IST)
Code:
to_char(field_name, 'DD/MM/YYYY HH24:MI:SS TZ') AS field_name
For Ex: When I am trying to sort the output records with the dates then it is not sorting properly.
So can anybody give some idea or example how to do this in other way and get rid of my issue.
Thanks and Regards,
Chittaranjan :)
Comment