Databases Reporting with SQL Date and Time Functions Review: Reporting with SQL

Kevin Gates
Kevin Gates
14,787 Points

So if you have a date + time, and you add a year, won't the result be a date + time? I thought you had to use STRFTIME?

So if you have a date + time, and you add a year, won't the result be a date + time? I thought you had to use STRFTIME to get either the DATE or the TIME?

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,370 Points

Are you referring to this quiz question?

What will the following function return?

DATE("2016-02-10 22:21:23", "+1 year")

1 Answer

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,370 Points

DATE() is what makes the result date only.

DATETIME("2016-02-10 22:21:23", "+1 year") would include the time