Type "Time" in SQL Server and C# Type "Time" in SQL Server and C# sql sql

Type "Time" in SQL Server and C#


According to MSDN:

Mapping CLR Parameter Data

You're looking for the TimeSpan type.


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!