Dofactory.com
Dofactory.com
Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

SQL DATEFROMPARTS Function

DATEFROMPARTS returns the date from the dateparts.

The specified dateparts include year, month, and day.

All three parameters are required.

Example

#

This example returns a date from the year, month, and day dateparts.

SELECT DATEFROMPARTS(2021, 9, 28) AS 'Returned Date'
Result:  1 record
Returned Date
2021-09-28

Syntax

Syntax of the DATEFROMPARTS function.

DATEFROMPARTS(year, month, day) 

year -- an integer specifying year (4 digits).

month -- an integer specifying month (1 - 12).

day -- an integer specifying day of month (1 - 31).

Note: DATEFROMPARTS will return an error if any of the arguments is invalid. If any of the arguments is null, then the return value will also be null.


You may also like



Last updated on Dec 21, 2023

Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.