【发布时间】:2014-01-15 13:35:17
【问题描述】:
我有一种情况,我收到以下格式的字符串形式的日期。
“2014 年 1 月 13 日星期一 00:00:00 GMT+0000(GMT 标准时间)”
我需要在 c# 中将其转换为以下格式(日期/字符串)以进行进一步处理
YYYY-MM-DD (2014-01-13)
Convert.ToDateTime(SelectedData)
以上代码出现以下错误:
'Convert.ToDateTime(SelectedData)' threw an exception
of type 'System.FormatException' System.DateTime {System.FormatException}
有什么建议吗?
我无法更改接收日期的格式 最好的问候。
【问题讨论】:
-
您是否总是收到完全相同的格式?
标签: c# datetime date-format