C#; .Net 3.5
MessageBox.Show(String.Format(“{0:MM/dd/yyyy}”, reader2[“SentDate”].ToString()));
returns:
7-12-2012 12:00:00 AM
SentDate is a SQL Date field (not datetime), and it only contains “2012-07-12” in the field.
What am I doing wrong? I only want to have the MessageBox display “7-12-2012” without the “12:00:00 AM”.
Take off the
.ToString(). You’re converting it to a string using the default format before sending it to the template.