Oracle received 00:00:00 and 59 minutes 59 seconds on the same day

Source: Internet
Author: User
-- Obtain the select TRUNC (SYSDATE) FROM dual; -- Obtain the 23: 59 minutes and 59 seconds of the current day (add one day and then minus one second based on the 00:00:00 of the current day) select trunc (SYSDATE) + 1-1/86400 FROM dual; -- the current date is the day of the week. Note: Sunday is the first day of the week. select to_char (sysdate, 'D'), to_char (sysdate, 'day') from dual; -- in oracle, how do I obtain the first and last DAY of the month of the current DAY select to_char (sysdate, 'yyyy-mm') | '-01' firstday, to_char (last_day (sysdate), 'yyyy-mm-dd') lastday from dual -- implement data before that day minus yesterday, after minus today select field1, field2 from mytablewhere time = decode (sign (sysdate-trunc (sysdate)-16/24), -- time judgment-1, trunc (sysdate) -1 + 16/24, -- get trunc (sysdate) + 16/24 at yesterday -- get 16 at on the same day

Related reading: Oracle's TO_DATE and TO_CHAR Functions

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.