工作中用到的

时间:2022-09-30 04:45:45

获取当前时间

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date
= new Date();
String time
= format.format(date);

 

时间戳

 //时间戳
String nowTime = System.currentTimeMillis()/1000L+"";

 

随机数

//随机数
Random random = new Random();
String flag
="";
for(int i=0;i<6;i++){
flag
+=random.nextInt(10);
}