Date & Time Functions

📝 Date & Time Functions

Total Questions: 7
Click an answer to select it, then click "Check Answers" to see your results.
Question 1

Which category of date and time functions retrieves the present date and time values from the system?

A.

A. Universal Current Date and Time Functions

B.

B. Current Date and Time Functions

C.

C. Date and Time Extraction Functions

D.

D. Time Difference Functions

Question 2


2. How does **SYSDATE()** differ from **NOW()** when used with a delay like **SLEEP(5)** in a query?

A.

A) **SYSDATE()** returns the same value as **NOW()**

B.

B) **SYSDATE()** reflects actual elapsed time with fresh timestamps per call

C.

C) **SYSDATE()** strips the time portion

D.

D) **SYSDATE()** only works outside queries

Question 3

What is the purpose of **Date and Time Extraction Functions**?


A.

A. To add or subtract intervals from dates

B.

B. To calculate intervals between two dates

C.

C. To extract components like year, month, or day from a date

D.

D. To convert dates to strings

Question 4

In the **DATE_FORMAT** function, what does the '%p' code represent?

A.

A. Two-digit year

B.

B. Minutes with leading zero

C.

C. AM/PM indicator

D.

D. Weekday number (0=Sunday)

Question 5

What is the primary purpose of the **STR_TO_DATE** function in MySQL?

A.

A) Convert a date to a formatted string

B.

B) Parse a string into a date object using a format specifier

C.

C) Create a date from year and day-of-year values

D.

D) Build a time from hour, minute, and second components

Question 6

Why should eCommerce applications record order timestamps in **UTC** rather than local time?

A.

A) To match the server's local time zone

B.

B) To reduce database storage size

C.

C) To simplify UI development

D.

D) To avoid discrepancies from varying user time zones

Question 7

What does the **DATEDIFF** function in MySQL return when given two dates?

A.

A. Difference in months

B.

B. Difference in days

C.

C. Difference in hours

D.

D. Difference in years

Quiz Complete!

Score: 0 / 7