Can anyone help me to print date in the format below
2016-11-22T14:52:17+05:30
without using JODA Time and apache fast date format.
Can anyone help me to print date in the format below
2016-11-22T14:52:17+05:30
without using JODA Time and apache fast date format.
Use SimpleDateFormat:
System.out.println(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date()));
or in Java8 DateTimeFormatter:
System.out.println(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ").format(ZonedDateTime.now()));