Time data format conversion for Oracle to_char

Source: Internet
Author: User
Tags julian day

Some function records of Oracle to_char.

1. Convert to year, month, day, hour, minute, and second;

2. Turning it into a subtle operation

SQL> select to_char (systimestamp, 'yyyy-mm-dd-hh24: mi: ss. ff') from dual;
 
TO_CHAR (SYSTIMESTAMP, 'yyyy-MM-
------------------------------
2013-09-26-16:08:04. 234000
 

Note that the parameter format is not converted to millisecond.

If you want to convert it to milliseconds

SQL> select to_char (systimestamp, 'yyyy-mm-dd-hh24: mi: ss. ff3') from dual;
 
TO_CHAR (SYSTIMESTAMP, 'yyyy-MM-
------------------------------
2013-09-26-16:12:10. 640
 



3. The number of seconds from the point to the current time

SQL> select to_char (systimestamp, 'yyyymmddhh24miss -- ssss') from dual;
 
TO_CHAR (SYSTIMESTAMP, 'yyyymmdd
------------------------------
20130926160938 -- 58178


SQL> select to_char (systimestamp, 'yyyy-mm-dd-hh24: mi: ss '),

2 to_char (systimestamp, 'yyyymmddhh24miss -- ssss '),
3 to_char (systimestamp, 'hh24') * 60*60 +
4 to_char (systimestamp, 'mi') * 60 + to_char (systimestamp, 'ss') +
5 to_number (to_char (systimestamp, 'ff')/1000000.00)
6 from dual
7/
 
TO_CHAR (SYSTIMESTAMP, 'yyyy-MM-TO_CHAR (SYSTIMESTAMP, 'yyyymmdd TO_CHAR (SYSTIMESTAMP, 'hh24') * 6
------------------------------------------------------------------------------------------
2013-09-26-16:00:13 20130926160013 -- 57613 57613
 

Other parameters are shown in the following table:




YYY IYI


Convert the date format of objective-c in other languages. For details, refer

Http://userguide.icu-project.org/formatparse/datetime



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.