1、固定格式 DateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String dateTime = sdf.format(new Date()); 2、毫秒形式 Calendar calendar = Calendar.getInstance(); Long time = calendar.getTimeInMillis()