I have problem with datetime format for C# and T-SQL.
- C# application is using DD.MM.YYYY HH.mm.SS format
- T-SQL is using MM\DD\YYYY HH.mm.SS format
Obviously T-SQL returns Error converting data type nvarchar to datetime. error.
Is there a way how to check and transform datetime format on SQL side? I would like T-SQL to be able to use DD.MM.YYY format.
Thanks.
DateTimeis aDateTimeis aDateTimeand doesn't have any formatting associated with it. You should use either parametrized queries, or if you really must have a date in string format, use the ISO-8601 standard format (YYYYMMDDorYYYYMMDDTHH:MM:SS)