Home >Database >Oracle >How to convert date format in oracle

How to convert date format in oracle

WBOY
WBOYOriginal
2022-01-25 17:26:4844615browse

In Oracle, you can use the "to_char" function to convert date format. This function is used to convert numeric or date type into character type. The syntax is "to_char(date,"conversion format")".

How to convert date format in oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How oracle converts date format

The function of Oracle to_char function is to convert numeric or date type into character type. The following is a detailed introduction to the use of Oracle to_char function. I hope it can be helpful to you. Helps.

Postgres formatting functions provide an efficient set of tools for converting various data types (date/time, int, float, numeric) into formatted strings and vice versa. Convert to original data type.

Note: The second parameter of all formatting functions is the template used for conversion.

How to convert date format in oracle

: Get the current date is the number of the month

 select to_char(sysdate,'YYYYMMDD W HH24:MI:SS') from dual; 
TO_CHAR(SYSDATE,'YY') 
select to_char(sysdate,'W') from dual;

2: Get the current date is the day of the week, note that Sunday is The first day

select sysdate,to_char(sysdate,'D') from dual;

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How to convert date format in oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn