Android timestamp format conversion (accurate to milliseconds, customizable format)

symbol meaning
yyyy Year
MM moon
dd Day
HH hour
mm point
ss Second
SSS millisecond
 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);

Guess you like

Origin blog.csdn.net/qq_27494201/article/details/135021091