Values for interval in SQL Server DateDiff functions

Source: Internet
Author: User
Tags time 0

Today, in the work of a problem, statistics this week, the use of the DateDiff function due to the confusion of W and week produce statistical results error

The setting values for the parameter interval are as follows:

Value Abbreviation (SQL Server) Description
Year Yy Year 1753 ~ 9999
Quarter Qq Season 1 ~ 4
Month MM or M Month 1 ~ 12
Day of the Year Dy or D The number of days in a year, the day of the year 1-366
Day Dd Day, 1-31
Weekday DW or W The number of days in a week, the day of the week 1-7
Week Wk Week, week of the year 0 ~ 51
Hour Hh Time 0 ~ 23
Minute Mi Minutes 0 ~ 59
Second Ss seconds 0 ~ 59
millisecond ms milliseconds 0 ~ 999
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.