Reputation: 289
I have the following code:
IFormatProvider culture = new System.Globalization.CultureInfo("es-ES", true);
date = DateTime.ParseExact(_date, "yyyy-MM-dd hh:mm", culture);
for _date = "2012-11-17 15:00"
it throws an exception
but for _date = "2012-11-17 10:00" works
Anyone can tell me what I'm doing wrong?
Upvotes: 4
Views: 71
Reputation: 263683
use HH
instead of hh
date = DateTime.ParseExact(_date, "yyyy-MM-dd HH:mm", culture);
HH
is for 24-hr
hh
is for 12-hr
Upvotes: 7