I am having a difficult time formatting the date/time to include "-07:00" as the time zone. An ideal example is "2018-06-19T14:45:10-07:00".
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault());
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
Calendar cal= Calendar.getInstance();
String dateTime = formatter.format(cal.getTime());
The result of this is something like
"2018-06-19T14:45:10"
. I want to have -07:00 at the end of it. I have also tried to change the formatter to include the timezone
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.getDefault());
The result of this is something like
"2018-06-19T14:45:10Z"
What am I doing wrong or missing?