Saturday, October 30, 2010 11:29 AMSQL: I want to Store date "ddmmyyyy" format, but SQLServer will accept "mmddyyyy".Then how could change this date format in C#.net and in SQL query, if giving input in Sql Editor.
Saturday, October 30, 2010 1:45 PM
search "sql server string to date time"
This has nothing to do with C#, by the way. The C# team does not involve in deciding SQL syntax parsing. If you need help writing T-SQL you should visit the forums under the SQL Server category.
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP
Saturday, October 30, 2010 2:39 PM
I hope this link will help you
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Regards, Alireza
Saturday, October 30, 2010 6:36 PM
SQL server does not acccept "mmddyyyy" that is complete nonsense
There are 3 datetime formats in SQL server which are in fact all a kind of object,
one is the DateTime which start at 1-1-1753 (start Gregorian calendar in the British Empire so also the USA at that time)
one is the ShortDateTime which starts at 1-1-1900
one is the DateTime2 starts equally with Net at 1-1-1 (SQL server 2008 and later)
What you show is a presentation date according to the region of the world where you living in while the one you show is only used in the USA.
If you want to store a datetime in a SQL server than use command parameters which automatically converts a Net DateTime to the DateTime format above which is used at SQL Server.
If your SQL Server has USA settings it will represent the datetime in the way you show.