I suggest you use explicit formats in your case, you can do that by using ParseExact
to get the DateTime
object and then providing the desired format to the ToString
overload:
string date = "15/01/2017";
DateTime date1 = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.CurrentCulture);
btnBack.Text = date1.ToString("MM-dd-yyyy");
solved How to convert dd/MM/yyyy string to MM-dd-YYYY DateTime int C#