我的系统时间格式为dd-MMM-yy
(02年12月2日)。我想将其转换为的格式是"yyyy/MM/dd"
。我基本已经与所有我的系统提供的其他日期时间格式玩耍,这是解析的语句,我要指出的是所有这些工作(除了这) -将系统时间格式的DateTime对象格式化为所需格式
CultureInfo provider = CultureInfo.InvariantCulture;
string date_format = "yyyy/MM/dd HH:mm:ss tt";
DateTime now_value = DateTime.ParseExact(DateTime.Now.ToString(date_format), date_format, provider);
return now_value.ToString(date_format);
但是这并未” t适用于上述dd-MMM-yy格式。有人能告诉我我在这里做错了吗?
(边栏-Is那里,我可以这样写上面的代码更有效的方式?)
'now.ToString('是它还是'now_value.ToString(' –
now_value。错字。谢谢。 – wave5459