SQL Date function

Source: Internet
Author: User
Tags date1

1. Day (date_expression)
Returns the date value in Date_expression

2. Month (date_expression)
Returns the month value in Date_expression

3. Year (date_expression)
Returns the year value in Date_expression

4, DATEADD ()
DATEADD (<DATEPART>, <number>, <date>)
Returns the new date specified by date plus the specified extra date interval number.
5, DATEDIFF ()
DATEDIFF (<DATEPART>, <date1>, <date2>)
Returns the DATEPART difference between the two specified dates, that is, the date2 exceeds the value of date1, and the resulting value is an integer value with a positive sign.

6, Datename ()
Datename (<DATEPART>, <date>)
Returns the specified part of the date as a string in this section. specified by DatePart.

7, DATEPART ()
DATEPART (<DATEPART>, <date>)
Returns the specified part of the date as an integer value. This section is specified by DatePart.
DATEPART (dd, date) is equivalent to day (date)
DATEPART (mm, date) equals month (date)
DATEPART (yy, date) is equivalent to year (date)

8, GETDATE ()
Returns the current date and time of the system in the default format of datetime

SQL Date function

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.