Is there a easy way to convert a DateTime object to a string representation like this '2010-03-03 10:38:48'.
I'm not sure what the above format is but it is different from the patterns obtainable via ToLongTimeString() etc.
Is this a case for string builder?
The "fff" custom format specifier represents the three most significant digits of the seconds fraction; that is, it represents the milliseconds in a date and time value.
Like this:
date.ToString("yyyy-MM-dd hh:mm:ss")
If you want 24 hour time, replace hh
with HH
.
For more information, see here.
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