I'm working in postgresql and I need to convert the date format in query itself,
in mysql there is option called DATE_FORMAT
and I can use a query like this:
Select DATE_FORMAT(date_time, '%b %e, %Y, %T') from table_name
is there any option in postgresql? Please let me know if any?
If I modify your
Select DATE_FORMAT(date_time, '%b %e, %Y, %T') from table_name
to
Select DATE_FORMAT(now(), '%b %e, %Y, %T')
it will return Aug 21, 2012, 16:51:30
.
You can do the same thing in Postgresql:
Select to_char(now(), 'Mon-dd-YYYY,HH24:MM:SS')
will return you Aug-21-2012,16:08:08
Hope your problem is sort out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With