Hi I am new to apex coding and am trying to parse a datetime and then later on in my program I am trying to convert it back into a string to query items.
For converting a string into a datetime I am using
String testDateString = '7/1/2015 1:30 PM';
DateTime testDate = DateTime.parse(sdate);
To convert the datetime back into a string I am using:
String convertedDate = testDate.formatGmt('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'');
but this gives me the string
2015-07-01T08:30:00.000Z, which would be correct if the time was
7/1/2015 1:30 AM
but I am expecting the string
Is there a reason why the
formatGmt ignores the AM/PM? Am i doing something clearly wrong?
Thanks for the help