DB2 date-time-timestamp Calculation

Source: Internet
Author: User
Tags db2 date

DB2 date-time-timestamp operation 1. Date value operation. When the date is increased or subtracted from the previous year, month, or day, the English word year, month, or day can be followed directly after the added or removed value; if the value is greater than 1, the plural form is used, as follows: values (current date, -- 2013-03-26 (current_date) current date + 10 years, -- 2023-03-26 current date-13 years, -- 2000-03-26 current date + 13 months, -- 2014-04-26 current date-24 months, -- 2011-03-26 current date + 60 days, -- 2013-05-25 current date-26 days -- 2013-02-28) 2. The time operation adds or removes the hour, minute, and second values on the specified time value, followed by hour, minute, and s. Econd. Values (current_time, -- 18:59:54 current_time + 10 hours, -- 04:59:54 current_time-23 hours, -- 19:59:54 current_time + 12 minutes, -- 19:11:54 current_time-63 minutes, -- 17:56:54 current_time + 25 seconds, -- 19:00:19 current_time-61 seconds -- 18:58:53) it must be noted that when the added or removed value is a floating point number, only the integer part is calculated, and the decimal part does not affect subsequent operations, sequence: year-> month-> day-> hour-> minute-> second 3. The timestamp operation combines 1st and 2nd. Values (current_timestamp, -- hour current_timestamp + 10.5 years, -- hour current_timestamp-4 months, -- hour + 26 days, -- hour current_timestamp + 7 hours, -- hour current_timestamp-5.2 minutes, -- 2013-03-26-19.42.52.414000 current_timestamp-1 second, -- 2013-03-26-19.47.51.414000 current_timestamp + 10 microseconds -- 2013-03-26-19.47.52.414010) Source http://blog.csdn.net/bobo12082119/article/details/8724586

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.