Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to use DateTime.TryParseExact as below:

DateTime modifiedSinceDateTime;

var succeeded = DateTime.TryParseExact(modifiedSince, "yyyy-MM-ddThh:mm:ss", 
    CultureInfo.InvariantCulture,
    DateTimeStyles.None,
    out modifiedSinceDateTime);

but it fails with this DateTime value: 2013-06-06T22:41:20 which suggests my date time pattern is not right. I think the pattern doesn't support 24 hours timing format, only up to 12 hours

What should be the correct date pattern like?

share|improve this question

1 Answer

Simple enough - change the hh to HH.

hh is for 12 hour clocks, HH for 24 hours, as can be seen in the documentation for Custom Date and Time Format Strings.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.