1) If pattern is like "MM/dd/yyyy HH:mm:ss tt" and the DateTime string is something like "5/28/2013 1:02:ss PM"
Yes, because you've specified that you'll give it a two-digit hour, and you've only given one digit. Note that if you're using an AM/PM designator, you probably want h
rather than H
anyway.
2) If pattern is like "MM-dd-yyyy HH:mm:ss tt" and the DateTime string is something like "5/28/2013 1:02:ss PM"
Yes, because you've specified that you want -
as the separator, but you're using /
in the text.
I suspect you want:
dateTimePattern = "M/dd/yyyy h:mm:ss tt";
Note that this has nothing to do with converting to UTC - it's just the parsing to LocalDateTime
that's causing you problems.