Multiple choice technology

Find the function that returns the week number of a particular date.

  1. datepart(week,getdate())

  2. datepart(wk,date())

  3. datepart(w,getdate())

  4. datepart(d,getdate())

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The DATEPART function in SQL Server returns a specific part of a date (like week, day, year). To get the week number, use DATEPART(week, GETDATE()) or DATEPART(wk, GETDATE()). The 'week' or 'wk' parameter specifies the week part. Option A uses the correct syntax with 'week'. Option C uses 'w' which typically stands for weekday, not week number.