SELECT
TO_CHAR((current_timestamp), 'YYYY-MM-DD HH:MM:SS AM') AS curr_time, current_timestamp, dbtimezone
FROM dual;
结果是:
curr_time 2014-05-22 12:05:23 PM
current_timestamp 22-MAY-14 12.39.23.447181000 PM ASIA/CALCUTTA
dbtimezone +00:00
为什么 curr_time 和 current_timestamp 相差几分钟?
请您参考如下方法:
因为 MM
是月,而不是分钟...(而 05 是...可能)
你必须使用MI
将格式更改为
'YYYY-MM-DD HH:MI:SS AM'