Friday, 11 February 2011 mvc c# changing the dateformat

There are times when you need to change the datetime format of the default date generated by System.DateTime.Now to some other.

Here how you can do it
string datetFormat = "dd-MMMM-yyyy hh:mm";
string date = Convert.ToDateTime(datetime).ToString(datetFormat);
It will generate 11-February-2011 06:13

No comments:

Post a Comment