Oracle to_date () and 24-hour notation and display of MM minutes

Source: Internet
Author: User

Oracle's solution is to_date () and 24-hour notation and the display of MM minutes:
I. Many JavaProgramLike me, the engineer may intuitively convert the format "yyyy-mm-dd hh: mm: SS", but it may cause an error in Oracle: "ora 01810 formatCodeAppears twice ".

For example:

SQL code
Select to_date ('1970-01-01 13:14:20 ', 'yyyy-mm-dd hh24: mm: ss') from dual;

The reason is that SQL statements are case-insensitive. mm and mm are considered to be the same format code, so Oracle SQL uses Mi instead of minutes.

SQL code
Select to_date ('1970-01-01 13:14:20 ', 'yyyy-mm-dd hh24: MI: ss') from dual;

2. Another 24-hour format is used to display hh24.

SQL code
Select to_char (sysdate, 'yyyy-mm-dd hh24: MI: ss') from dual; // Mi is a minute select to_char (sysdate, 'yyyy-mm-dd hh24: MM: ss') from dual; // mm displays the month
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.