Here you can find the source of formatTime(long millis)
Parameter | Description |
---|---|
millis | a timestamp in milliseconds. |
public static String formatTime(long millis)
//package com.java2s; /*// ww w . j a va2 s . c om * Copyright (c) 2015-2016 QuartzDesk.com. * Licensed under the MIT license (https://opensource.org/licenses/MIT). */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String TIME_FORMAT_HH_MM_SS_SSS = "HH:mm:ss.SSS"; /** * Returns a string representation of the specified time value * in hh:mm:ss.SSS format in the local time zone. * * @param millis a timestamp in milliseconds. * @return the string representation of the specified time. */ public static String formatTime(long millis) { SimpleDateFormat f = new SimpleDateFormat(TIME_FORMAT_HH_MM_SS_SSS); return f.format(new Date(millis)); } }