click below
click below
Normal Size Small Size show me how
Datetime Functions
This study stack goes along with the lecture CSCI 2141: Datetime functions
Question | Answer |
---|---|
What does the DATE() function return? | The DATE() function extracts the date part from a datetime expression. |
What does the TIMESTAMP() function return? | The TIMESTAMP() function returns a datetime value based on the given date. |
What does the TIME() function return? | The TIME() function extracts the time part from a given datetime expression. |
What doe the YEAR() function return? | The YEAR() function returns the year part for a given date. |
What are the upper and lower bounds of the YEAR() function? | 1000 to 9999 |
What does the DATEDIFF() function return? | The DATEDIFF() function returns the number of days between two date values. |
When do you get a negative value using the DATEDIFF() function and why? | When the second given date is later than the first because the function subtracts the second date from the first. |
What does the DATE_ADD() function return? | The DATE_ADD() function adds a date interval to a date and then returns the date. |
What does the STR_TO_DATE() function return? | The STR_TO_DATE() function returns a date based on the gievn format. |
What does the CAST() function do? | The CAST() function converts a value of any type into a specified datatype. |
What does the CONVERT() function do? | The CONVERT() function converts a value into the specified datatype or character set. |