Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下代码:
IFormatProvider culture = new System.Globalization.CultureInfo("es-ES", true); date = DateTime.ParseExact(_date, "yyyy-MM-dd hh:mm", culture);
对于_date =“2012-11-17 15:00”
它抛出一个异常
但是对于 _date = "2012-11-17 10:00" 有效
谁能告诉我我做错了什么?
使用HH而不是hh
HH
hh
date = DateTime.ParseExact(_date, "yyyy-MM-dd HH:mm", culture);
HH是24 小时 hh是12 小时