Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date format
Message
From
08/02/2019 18:33:28
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
01666138
Message ID:
01666145
Views:
55
This message has been marked as the solution to the initial question of the thread.
>Hi,
>
>Could you please explain why (where is the rule?) the SQL Server always looks at the date in the following format: 'yyyyMMdd' (no matter the date format of the country where the SQL Server is installed).
>
>That is, the following code:
>
>DECLARE @SomeDate AS SmallDateTime
>SELECT @SomeDate = '20190204'
>SELECT @SomeDate
>
>
>always returns February 4th of 2019 (and NOT April 2nd).
>
>TIA

Dmitry,

I'll guess a bit here and assume that MSSQL tries to follow ISO8601. I think that an unambiguous datetime representation is given by yyyy-mm-ddThh:mm:ss. Notice the T between date and time parts: that's an ISO8601 convention that I believe MSSQL recognizes and uses, no matter what regional settings are in place.

yyyymmdd is a valid ISO8601 short representation of a date.
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform