Time data format conversion of Oracleto_char

Source: Internet
Author: User
Some function records of Oracleto_char. 1. Convert to year, month, day, hour, minute, and second operations; 2. convert to a subtle operation SQLgt; selectto_char (systimestamp,

Some function records of Oracle to_char. 1. Convert to year, month, day, hour, minute, and second operations; 2. convert to a subtle operation SQLgt; select to_char (systimestamp,

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

Related reading:

Oracle modifies the default time format

Modify the time format of Oracle SQL Developer

Oracle time format conversion Exception Handling Function

Oracle time formatting

How Does Oracle modify the system default time format?

Other parameters are shown in the following table:

ParameterExplanation

YEARYear, spelled out

YYYY4-digit year

YYY
YY
YLast 3, 2, or 1 digit (s) of year.

IYY
IY
ILast 3, 2, or 1 digit (s) of ISO year.

IYYY4-digit year based on the ISO standard

QQuarter of year (1, 2, 3, 4; JAN-MAR = 1 ).

MMMonth (01-12; JAN = 01 ).

MONAbbreviated name of month.

MONTHName of month, padded with blanks to length of 9 characters.

RMRoman numeral month (I-XII; JAN = I ).

WWWeek of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.

WWeek of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.

IWWeek of year (1-52 or 1-53) based on the ISO standard.

DDay of week (1-7 ).

DAYName of day.

DDDay of month (1-31 ).

DDDDay of year (1-366 ).

DYAbbreviated name of day.

JJulian day; the number of days since January 1, 4712 BC.

HHHour of day (1-12 ).

HH12Hour of day (1-12 ).

HH24Hour of day (0-23 ).

MIMinute (0-59 ).

SSSecond (0-59 ).

SSSSSSeconds past midnight (0-86399 ).

FFFractional seconds.

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

,
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.