Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date format
Message
De
08/02/2019 18:33:28
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01666138
Message ID:
01666145
Vues:
56
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform