Last active
December 23, 2015 14:58
-
-
Save mmarcon/6651955 to your computer and use it in GitHub Desktop.
milliseconds to pretty date in Java
This file contains 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
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Calendar; | |
public class DateUtil { | |
public static String getDate(long milliSeconds) { | |
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS"); | |
Calendar calendar = Calendar.getInstance(); | |
calendar.setTimeInMillis(milliSeconds); | |
return formatter.format(calendar.getTime()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment