Oracle TO_CHAR (timestamp) and timestamp differ in minutes and seconds

oracle, sql, timestamp

Solution

because `MM` are month, not minutes... (and 05 is... may)

You have to use `MI`

Change your format to

'YYYY-MM-DD HH:MI:SS AM'

Problem

``` SELECT TO_CHAR((current_timestamp), 'YYYY-MM-DD HH:MM:SS AM') AS curr_time, current_timestamp, dbtimezone FROM dual; ``` The result is: ``` curr_time 2014-05-22 12:05:23 PM current_timestamp 22-MAY-14 12.39.23.447181000 PM ASIA/CALCUTTA dbtimezone +00:00 ``` why do curr_time and current_timestamp differ by minutes?

Original source