将时间格式化到毫秒显示,直接看代码:
import java.text.SimpleDateFormat;
/**
* @author : chenfan
* @className : MyTest
* @date : Created in 2021/1/27 16:51
* @description : 时间格式化的示例
*/
public class MyTest {
public static void main(String[] args) {
String time = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss.SSS”).format(System.currentTimeMillis());
System.out.println(“现在时刻:”+time);
}
}