Created
April 15, 2022 08:57
-
-
Save massimilianochiodi/cb359f717b44604811202ae49c9cf4a3 to your computer and use it in GitHub Desktop.
Timestamp to unix datetime (java)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String getDate(long time) { | |
Calendar cal = Calendar.getInstance(Locale.ENGLISH); | |
TimeZone tz = TimeZone.getTimeZone("GMT"); | |
cal.setTimeZone(tz); | |
cal.setTimeInMillis(time * 1000); | |
String cosa = DateFormat.format("yyyy-MM-dd'T'HH:mm", cal).toString(); | |
return String.format("%s:00Z",cosa); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment