Skip to content
Advertisement

C# is adding 00:00:00 unnecessarily

My SQL Server is using the DATE datatype, but my C# app is reading this as ‘mm/dd/yyyy 00:00:00’, can anyone tell me how to get rid of the 0s? (everything else works)…?

Advertisement

Answer

If you don’t want the time portion of a DateTime as String you have several options:

Read: Date and time format strings

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement