SQL statement in Oracle time format

Source: Internet
Author: User

SQL statement in Oracle time format

-- 12-hour system current time (AM) SQL> select to_char (sysdate, 'yyyy-MM-DD HH12: MI: SS am') from dual; -- 24-hour system current time (PM) SQL> select to_char (sysdate, 'yyyy-MM-DD HH24: MI: SS pm') from dual; -- select to_char (Sysdate + 1, 'yyyy-MM-DD HH24: MI: ss') from dual; -- select to_char (Sysdate + 1/24, 'hh24: MI: ss') from dual; -- select to_char (Sysdate-1/21/60, 'hh24: MI: ss') from dual; -- get the data after a certain time point (it is useful for incremental operations) Date type TIME select * From T_TABLE where LAST_MODIFY_TIME> TO_DATE ('2017-05-08 14:34:45 ', 'yyyy-mm-dd hh24: mi: ss ') -- select * from T_TABLE where UPDATED_TIME> TO_TIMESTAMP ('2017-08-08 13:30:00 ', 'yyyy-mm-dd hh24: mi: ss. ff ') -- MySql Timestamp time type last_modified, select * from t_XXXX where last_modified> '2017-03-07 15:31:43 'of datetime type -- insert into T_XXX (name1, name2, update_time) values (?,?, Sysdate); // update_time is of the Timestamp type Sysdate: Current System Time -- insert the to_date (), TO_TIMESTAMP () insert into T_XXX (name1, name2, update_time) values (?,?, To_date ('1970-2-28 15:42:56 ', 'yyyy-mm-dd hh24: mi: ss'); insert into T_XXX (name1, name2, last_modify_time) values (?,?, TO_TIMESTAMP ('2017-08-08 14:30:00 ', 'yyyy-mm-dd hh24: mi: ss. ff '));

 

 
-- Time Format parameter description Year: yy two digits two-Year display value: 07 yyy three digits three-Year display value: 007 yyyy four digits four-digit Year display value: 2007 Month: mm number two-month display value: 11 mon abbreviated Character Set indicates display value: January 1, November. If the English version is used, nov month spelled out Character Set indicates display value: January 1, November. If the English version is used, November Day is displayed: dd number display value for the day of the month: 02 ddd number display value for the day of the year: 02 dy abbreviated display value for the day of the week: Friday, if it is an English version, show fri day spelled out full write display value for the day of the week: Friday, if the English version, display Friday ddspth spelled out, ordinal twelfth Hour: hh two digits 12 small display value: 01 hh24 two digits 24 hour display value: 13 Minute: mi two digits 60 hexadecimal display value: 45 Second: ss two digits 60 hexadecimal display value: 25 other Q digit Display values for the quarter: 4 WW digit Display value for the week of the current year: 44 W digit Display value for the week of the current month: 1 24 hours format time range: 0:00:00-23:59:59 .... the time range in the 12-hour format is: 1:00:00-12:59:59 ....

 


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.