Is it possible to include an alphabetic character in a SimpleDateFormat Pattern String?
I am trying to create a format string where the letter ‘T’ is included before the time for example:
2003-11-15T09:30:47-05:00.
I am currently using yyyy-MM-ddhh:mm:ssZ as the pattern string.
If I change it to yyyy-MM-ddThh:mm:ssZ it will throw an exception as ‘A’ to ‘Z’ and ‘a’ to ‘z’ are reserved.
Is there any solution that does not involve using two DateFormats?
Surrounding the
Twith single quotes should work:Quoting from the documentation (emphasis mine):
Your specific use case is even included as an example: