0

我阅读了很多交替使用 hh23 和 hh24 的教程。在 oracle 上做 to_char。hh23 是传统语法吗?我尝试在简单查询上执行此操作,但会导致错误。

选择 to_char(sysdate, 'hh23'), to_char(sysdate, 'hh24') from dual

我正在尝试找到对此的参考,但没有。还是刚才的教程写错了?例如在http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:59412348055上。

4

2 回答 2

2

这只是未经测试的代码中的打字错误。'hh23' 总是会出错。

于 2011-09-26T10:44:33.890 回答
2

我认为这只是一个错字。

SQL> select to_char(sysdate, 'hh23:mi:ss') from dual
  2  /
select to_char(sysdate, 'hh23:mi:ss') from dual
                        *
ERROR at line 1:
ORA-01821: date format not recognized


SQL> select to_char(sysdate, 'hh24:mi:ss') from dual
  2  /

TO_CHAR(
--------
11:25:21

SQL>
于 2011-09-26T10:45:30.130 回答