Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dealing with dates
Working with time data
Date and time date
Extracting dates and times
Doing arithmetic with dates
Converting date and time data
Building date and time data from parts
47. Other functions
Summary and review

Instruction

Great! There are many other functions that you can use to achieve similar result. Take a look at the comparison below:

  • DATEFROMPARTS(year, month, day)—allows you to create a date. Its arguments are self-explanatory.
  • TIMEFROMPARTS(hour, minute, second, fraction, precision)—the first three arguments are self-explanatory. The fraction sets the value to a fraction of second, while precision sets the number of digits in the precision of the fraction.
  • SMALLDATETIMEFROMPARTS(year, month, day, hour, minute)—creates a date time of type SMALLDATETIME. It does not handle seconds and fractions of a second; however, it sets the seconds to 0. This behaviour cannot be changed.
  • DATETIMEFROMPARTS(year, month, day, hour, minute, second, millisecond)—creates a date time of type DATETIME. The arguments are self-explanatory. The millisecond argument sets the number of milliseconds (i.e., a fraction with precision set to 3).

Exercise

Click Next exercise to continue.