I want to convert the type Long
that returns new Date().getTimeInMillis()
to String
The following code does not work, generates a time different from my time zone
private String formatDate(Long fechaInTypeLong) {
Date date = new Date(fechaInTypeLong);
SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
return formato.format(date);
}
How to convert in String
according to UTC
?