2018/05/18 13:30:42-0400
gets printed by the below code but I want 2018/05/18 13:30:42 +00:00
to be printed.
public static void main(String[] args) throws Exception{
String input = "2018/05/18 13:30:42 +00:00";
SimpleDateFormat parser = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = parser.parse(input);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ssZ");
String formattedDate = formatter.format(date);
System.out.println(formattedDate);
}