How to get the system current time in Oracle ____oracle

Source: Internet
Author: User
Tags current time
How Oracle obtains system current time   Select To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') from dual;    Oracle gets a time of year, quarter, month, week , the function of the day   select  to_char (sysdate, ' yyyy ')  from dual; --year     Select  to_char (sysdate, ' MM ')  from dual; --month   Select  to_char (sysdate, ' DD ')  from dual; --Day   Select  to_char (sysdate, ' Q ')  from dual; --season   Select  to_char (sysdate, ' IW ')  from dual; --week--according to the calendar, there are 52 or 53 weeks per year  /*  hh hours (a)   hh24 hours (a)   Mi cent   SS sec   D Week of the day of the week of   DDD year &N Bsp The first weeks of the WW year   W the week of the month--January 1 to January 7 of the year is week one, and so on, 53 weeks a year   */      Get system date: Sysdate ()   format Date: &N Bsp      to_char (Sysdate (), ' Yy/mm/dd HH24:MI:SS)     or to_date (Sysdate (), ' Yy/mm/dd HH24:MI:SS ') &    nbsp Select To_char (sysdate, ' yyyy-mm-dd HH24:mi:ss ')  from dual;  select To_char (sysdate, ' yyyy-mm-dd HH24:mm:ss ') )  from dual;  Select To_char (sysdate, 'Yy-mm-dd hh24:mi:ss ')  from dual  Select To_date (' 2009-12-25 14:23:31 ', ' Yyyy-mm-dd,hh24:mi:ss ') from DUAL&NB   Sp And if the upper-style writing:  select  to_date (' 2009-12-25 14:23:31 ', ' yyyy-mm-dd,hh:mi:ss ')  from dual  will be the error, because the hour HH is 12 binary, 14 is illegal input, cannot match.   Conversion Format:  represents the year's:      y for the last one,   yy to represent the last 2 digits of the year, the   yyy the last 3 digits of the year, and the   y YYY 4 digits for the year   month:      mm with 2-digit number for the month,   mon in shorthand form, such as November or Nov,   month with full name, such as November or   november  represents Day's:      DD for days of the month,   DDD indicates the days of the year,   dy Zhou Di days, such as Friday or Fri,   Day when Zhou Di a few days, full name, such as Friday or friday  hour:      HH 2 digits for hours 12,   hh24 2-digit hours 24 hours   means min Ute's:      mi 2 digits for minutes   second:      SS 2 digits in seconds 60 in   for quarter:    &NB Sp Q A number for quarterly (1-4)   There is also WW used to indicate the first weeks of the year in which W is used to denote the week of the month.     Current time minus 7 minutes   Select   Sysdate,sysdate -Interval ' 7 ' MINUTE  from  dual;  current time minus 7 hours   Select   Sysdate-interval ' 7 ' hour &nbs P;from dual;  Current time minus 7 days   select   sysdate-interval ' 7 ' Day  from dual;  current time minus July time &NB    Sp Select   Sysdate,sysdate-interval ' 7 ' month  from dual;  current time minus 7 year time   select   Sysdate,sys Date-interval ' 7 ' year  from dual;  time interval multiplied by a number   select   sysdate,sysdate-8*interval ' 7 ' hour  from dual;             Select To_char (sysdate, ' Yyyy-mm-dd:hh24:mi:ss:pm:dy ') from dual;                       24 hours/day/afternoon week Chinese;      --Get November days--select to_char (to_date (' 2010-11-1 ', ' yyyy-mm-dd ')), ' DD ' from dual;  -Get December days--select to_char (to_date (' 2010-12-1 ', ' yyyy-mm-dd ')), ' DD ' from dual;       shows that last Monday to Sunday  select To_char (sysdate, ' YYYYMMDD')-to_number (To_char (sysdate, ' d ')-1)-6, To_char (sysdate, ' YYYYMMDD ')-to_number (To_char (sysdate, ' d ')-1)    from Dual



Turn from: http://www.2cto.com/database/201304/202675.html
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.