What is a neutral date format for SQL Server

I have had this question from the very beginning of my programming career. Is there really a culture-neutral format for datetime in the sql server, so when ever I send a query string from the client side to the database server running SQL Server 2008, which has a different system time and time format, and if the request contains a date converted to a string, which format would not give me an error.

+5
source share
2 answers

I recommend reading the Tibor Karaszi Ultimate datetime datatypes guide .

If you enter the date / time in an unseparated or ISO 8601 format, then you should be fine with any configuration.

Unseparated = 'yyyymmdd hh:mm:ss'
ISO 8601    = 'yyyy-mm-ddThh:mm:ss'

Update (from comments):

If you need to enter only the date (without the time part), then you must use the format 'YYYYMMDD', as 'YYYY-MM-DD'it will not work. See the related article for an example.

+10
source

You might consider storing the date / time in UNIX time format .

0
source

All Articles