This is working for me
val cal = Calendar.getInstance()
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
cal.setTimeInMillis(cal.getTimeInMillis());
return DateFormat.format(yyyy-MM-dd'T'HH:mm:ss,
cal).toString();
This is working for me (code is in Kotlin)
val cal = Calendar.getInstance()
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
cal.setTimeInMillis(cal.getTimeInMillis());
return DateFormat.format(yyyy-MM-dd'T'HH:mm:ss,
cal).toString();