Oracle date conversion function syntax

Source: Internet
Author: User

To_date () is the Oracle date conversion function. You can convert the character type to the date type in a certain format. Let's take a look at the syntax of the Oracle date conversion function.

The biggest relationship with the date operation is the two conversion functions: to_date (), to_char ()
To_date () converts the character type to the date type in a certain format:
Usage: to_date ('1970-11-27 '', ''yyyy-mm-dd''). The former is a string, and the latter is a conversion date format. Note, the two must be one-to-one.
For example, to_date ('2017-11-27 13:34:43 '', ''yyyy-mm-dd hh24: mi: s'') will get the specific time

Multiple date formats:

YYYY: Year in four bits
YYY, YY, Y: the last three digits, two digits, or one digit of the year. The default value is the current century.
MM: 01 ~ 12 month number
MONTH: The MONTH, which contains nine characters. Fill the MONTH with spaces on the right.
MON: the abbreviation of A Three-character month
WW: week of the year
D: The day of the week
DD: The day of the month.
DDD: The day of the year
DAY: The full name of the DAY, expressed in nine characters, and filled with spaces on the right
HH, HH12: the hour of the day, 12 hexadecimal notation
HH24: The hour in a day. The value ranges from 00 ~ 23
MI: minute in an hour
SS: seconds in one minute
SSSS: the number of seconds since midnight

To_char (): Convert the date to a certain format to the character type
SQL> select to_char (sysdate, ''yyyy-mm-dd hh24: mi: s'') time from dual;

The preceding section describes the syntax of Oracle date conversion functions.

Oracle Pipeline Function usage

Use of oracle custom functions

Oracle date functions

Introduction to Oracle System Variable Functions

Syntax for creating an Oracle package

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.