Reputation: 91
Is there any way that I can create the type time in C# to be compatible with the type time of the SQL server?
Upvotes: 9
Views: 10425
Reputation: 11
try using the below date formatter in C#.
DateTime dateTime = DateTime.Now; string text = dateTime.ToString("yyyy'-'MM'-'dd HH':'mm':'ss.fff");
This will lead to the same format as sql date format 'yyyy-mm-dd hh:mm:ss.fff'
Thanks!
Upvotes: 1
Reputation: 245399
According to MSDN:
You're looking for the TimeSpan type.
Upvotes: 21