首页 > 代码库 > DateTime.ToString("dd/MM/yyyy");后,不能直接Convert.ToDateTime的解决:

DateTime.ToString("dd/MM/yyyy");后,不能直接Convert.ToDateTime的解决:

原文: DateTime.ToString("dd/MM/yyyy");后,不能直接Convert.ToDateTime的解决:

DateTime.ToString("dd/MM/yyyy");后,不能直接Convert.ToDateTime的解决:

 

 DateTime.ParseExact(this.DateBegin.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.GetCultureInfo("en-US")).ToString("yyyy-MM-dd") ;

DateTime dt = DateTime.ParseExact(dateString, "yyyy/mm/dd", CultureInfo.InvariantCulture);

DateTime dt = DateTime.Now;string dateAsString = dt.ToString("dd/MM/yyyy");// If the source data is a stringstring dtString = "2014/03/12";DateTime dtTarget;if (DateTime.TryParseExact(dtString,    "yyyy/MM/dd",    System.Globalization.CultureInfo.CurrentCulture,    System.Globalization.DateTimeStyles.None,    out dtTarget)){    dtString = dtTarget.ToString("dd/MM/yyyy");}