I am trying
new SimpleDateFormat("yyyy-mm-dd'T'hh:mm:ssZ").format(Calendar.getInstance().getTime())
and the output which I am getting is 2018-16-11T07:16:48+0530
. But the expected one is 2018-16-11T07:16:48+05:30
.
I am trying
new SimpleDateFormat("yyyy-mm-dd'T'hh:mm:ssZ").format(Calendar.getInstance().getTime())
and the output which I am getting is 2018-16-11T07:16:48+0530
. But the expected one is 2018-16-11T07:16:48+05:30
.
You have to use XXX instead of Z for timezone to get it in the format you want:
new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssXXX");
Reference: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html