Is there any way that I can create the type time in C# to be compatible with the type time of the SQL server?
The TIMESTAMP data type consists of a date and time, with optional time zone.
In C# a DateTime data type is a struct type that represents an instant of time.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With