How to I format datetime from sql to certain format user defined in C#? For example, the datetime in sql is like 2011-02-06 12:00:21, the user defined format is mmddyyyy, I am expecting output is 02062011 (note that not 262011). How do I do the conversion in C#?
Share
This should do it:
Assuming
reader["DateColumn"]returns aDateTimeobject