You develop a database for a travel application. You need to design tables and other database objects.You
create a view that displays the dates and times of the airline schedules on a report. You need to display dates
and times in several international formats. What should you do?
A.
Use the CAST function.
B.
Use the DATE data type.
C.
Use the FORMAT function.
D.
Use an appropriate collation.
E.
Use a user-defined table type.
F.
Use the VARBINARY data type.
G.
Use the DATETIME data type.
H.
Use the DATETIME2 data type.
I.
Use the DATETIMEOFFSET data type.
J.
Use the TODATETIMEOFFSET function.
Explanation:
Reference: http://msdn.microsoft.com/en-us/library/hh213505.aspx
I think the correct answer is I
yes, I should be the correct Answer.
Actually you just want to “DISPLAY dates and times in sever international FORMATS”. No need for timezone information from DATETIMEOFFSET, so C is correct.
JV has a point. You only need to “display”, not “store”. The FORMAT function does exactly that
C
Use the FORMAT function for locale-aware formatting of date/time and number values as strings.
Examples:
DECLARE @d DATETIME = ’10/01/2011′;
SELECT FORMAT ( @d, ‘d’, ‘en-US’ ) AS ‘US English Result’
,FORMAT ( @d, ‘d’, ‘en-gb’ ) AS ‘Great Britain English Result’
,FORMAT ( @d, ‘d’, ‘de-de’ ) AS ‘German Result’
,FORMAT ( @d, ‘d’, ‘zh-cn’ ) AS ‘Simplified Chinese (PRC) Result’;
SELECT FORMAT ( @d, ‘D’, ‘en-US’ ) AS ‘US English Result’
,FORMAT ( @d, ‘D’, ‘en-gb’ ) AS ‘Great Britain English Result’
,FORMAT ( @d, ‘D’, ‘de-de’ ) AS ‘German Result’
,FORMAT ( @d, ‘D’, ‘zh-cn’ ) AS ‘Chinese (Simplified PRC) Result’;
Agree with JV. Format is correct for display.