how can I format date to display in the following format 03-Feb-2011
I tried this statement but it did not work properly
string.Format(visitDate.Valu
string.format is valid but the parameter order you use are invalid:
DateTime? visitDate = null;
System.Diagnostics.Debug.WriteLine(visitDate == null ? "" : String.Format("{0:dd-MMM-yyyy}", visitDate));
visitDate = DateTime.Now;
System.Diagnostics.Debug.WriteLine(visitDate == null ? "" : String.Format("{0:dd-MMM-yyyy}", visitDate));
That should do the trick.