Android时间戳格式转换(可精确到毫秒、可自定义格式)

符号 含义
yyyy
MM
dd
HH
mm
ss
SSS 毫秒
 long time = System.currentTimeMillis();
 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS");
 String date = sdf.format(time);

猜你喜欢

转载自blog.csdn.net/qq_27494201/article/details/135021091