Skip to content

Instantly share code, notes, and snippets.

@mmarcon
Last active December 23, 2015 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmarcon/6651955 to your computer and use it in GitHub Desktop.
Save mmarcon/6651955 to your computer and use it in GitHub Desktop.
milliseconds to pretty date in Java
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