Some of the time transformations commonly used by Oracle

Source: Internet
Author: User

Some commonly used are time formats


Select To_char (sysdate, ' HH24:MI:SS AM ') from dual---12:56:40 pm

Select To_char (To_date (' 2 January-January -95 '), ' yyyy-mm-dd HH24:MI:SS AM ') from dual---1995-01-21 00:00:00

Select To_char (sysdate, ' DD ' of ' MONTH ') from dual---July

Select To_char (To_date (' 2 May-July -95 '), ' DD ' of ' MONTH ') from dual---of July

Select To_char (sysdate, ' ddspth ') from dual---twenty-eighth

Select TRUNC (To_date (' 2 May-July -95 '), ' ddspth ') from dual-1995-7-25




---date format query

Select To_char (to_date (' 26-08-2002 ', ' dd-mm-yyyy '), ' Day ') from dual;--Monday


Select To_char (to_date (' 2002-08-26 ', ' Yyyy-mm-dd ')) from dual; --2 June-August-02


Select To_date (' 2002-08-26 ', ' YYYY-MM-DD ') from dual; --2002-8-26

Select To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') from dual; ---2015-07-28 13:01:14

--Days of the month

SELECT To_char (Last_day (sysdate), ' DD ') Day from dual--31 (number of days)


Some of the time transformations commonly used by Oracle

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.