Tuesday, February 9, 2016

Convert DateTime to Month-Year format in C#

 

string converttoString = Convert.ToString(changedtxt.ToString("dd-MMM-yyyy"));
string getYear = converttoString.Substring(9, 2);
string getMonth = converttoString.Substring(3, 3);
string Month = getMonth + "-" + getYear;//Dec-15 (Example)

No comments:

Post a Comment