时间格式化到毫秒 - 用Java的处理方法
将时间格式化到毫秒显示,直接看代码:
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);
    }
    
} 
运行结果:
现在时刻:2021-01-27 16:52:16.307
附录:
Java时间格式化字母表

