fork download
  1. import java.time.OffsetDateTime;
  2.  
  3. class Main {
  4. public static void main(String[] args) {
  5. OffsetDateTime odt = OffsetDateTime.parse("2016-01-11T14:08:42+00:00");
  6. System.out.println(odt);
  7.  
  8. // String manipulation to replace Z with +00:00
  9. String formatted = odt.toString().replace("Z", "+00:00");
  10. System.out.println(formatted);
  11. }
  12. }
Success #stdin #stdout 0.13s 56840KB
stdin
Standard input is empty
stdout
2016-01-11T14:08:42Z
2016-01-11T14:08:42+00:00