Get the appropriate information from the date

Source: Internet
Author: User

To create a test table:

CREATE OR REPLACE VIEW v asselect to_date (' 2015-5-5 13:14:15 ', ' yyyy-mm-dd HH24:MI:SS ') as C from DUAL; SELECT * from V;

The SQL code is as follows:

SELECT C,       To_char (c, ' hh24 '),       To_char (c, ' mi ') minutes,       To_char (C, ' SS ') seconds,       To_char (c, ' DD ') day,       To_char (c, ' mm ') month,       To_char (c, ' yyyy ') years,       To_char (c, ' DDD ') the first day of the year,       TRUNC (c, ' DD ') at the beginning of the       Week, TRUNC (c, ' Day '), 
  trunc (c, ' mm ') at the beginning of the month,       Last_day (c),       add_months (TRUNC (c, ' mm '), 1) early next month,       TRUNC (c, ' yyyy '),       to_ CHAR (c, ' Day ') weeks,       To_char (c, ' Month ') month from  v;

The results of the implementation are as follows:

Get the appropriate information from the date

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.