Date functions for SQL

Source: Internet
Author: User
Tags date1 integer time interval

The date function is shown in the following table.
Description
The datename and DATEPART functions return the integer value of the string that corresponds to the specified date element in the date, respectively.

Function Parameters Function
GETDATE () Returns the current date and time of the system
DATEADD (datepart,number,date) Returns datetime or smalldatetime type data whose value is the date value plus the time interval specified by the DATEPART and number parameters
DATEDIFF (DATEPART,DATE1,DATE2) Returns the interval between Date1 and Date2, which is specified by the datepart parameter
Datename (datepart,date) Returns the string corresponding to the specified part of the date
DATEPART (datepart,date) Returns the integer value of the specified part of the date

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.