my question looks simple: in my client/server application I want to record a specific date provided by the client.
The problem is that I don’t know the regional settings of the client, and I don’t know the regional settings of the SQL Server.
How can the client application provide a date in whatever format (last login of a specific user) and store it in a SQL Server table that might be installed with a different regional settings (french, english, italian, german, etc…).
Simple: don’t use strings. Use a parameter that is typed as a datetime; can be as simple as:
or with “dapper”:
Dates/times are actually just numbers. It is only when you write/parse it as a string that formatting is an issue.