【发布时间】:2013-09-06 21:26:14
【问题描述】:
如何将 04/09/2013 8:09:10 PM 转换为 09/04/2013 (MM-dd-yyyy)。我尝试转换,但日期为 09,月份为 04。
请帮忙
[HttpPost]
public string getdailynote(DateTime selectedDate)
//selectedDate gets date as 04/09/2013 8:09:10 PM
{
string x = selectedDate.ToString("MM-dd-yyy", CultureInfo.InvariantCulture);
string daily;
DateTime dt = Convert.ToDateTime(x);
//dt gets value as {09/04/2013 12:00:00 AM} but 09 as date and 04 as month
Dnote.RealDate =dt;
daily = _scheduler.GetDailyNote(Dnote);
return daily;
}
【问题讨论】:
-
试试
selectedDate.ToString("dd-MM-yyyy") -
重复问题
-
@SenthilKumar 请标记问题,这将有助于了解更多信息,