LocalDate now = LocalDate.now();
logger.info("当前时间:"+now.toString());//当前时间:2020-11-28
LocalDateTime now2 = LocalDateTime.now();
logger.info("LocalDateTime:"+now2.toString());//LocalDateTime:2020-11-28T21:21:20.470
Instant now1 = Instant.now();
logger.info("当前时间戳:"+now1.toString());//当前时间戳:2020-11-28T13:21:20.469Z
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
String format = simpleDateFormat.format(date);
logger.info("old 时间:"+format);//old 时间:2020-11-28 21:21:20
long l = System.currentTimeMillis();
logger.info("old 时间戳:"+l);//old 时间戳:1606569680469
时间函数笔记
最新推荐文章于 2021-10-28 17:07:31 发布