直播app源码,JAVA8 时间格式转换
直播app源码,JAVA8 时间格式转换
DateTimeFormatter formatter= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");//对象转字符串String t
imeStr = formatter.format(LocalDateTime.now());System.out.println(timeStr);//字符串转对象LocalDateTime time = Loc
alDateTime.parse("2020-10-11 12:23:34",formatter);System.out.println(time);//对象转long(秒数)Long seconds = time.toEp
ochSecond(ZoneOffset.of("+8"));System.out.println(seconds);//long转对象LocalDateTime time2 = LocalDateTime.ofEpochSecond(1602390214,0,ZoneOffset.of("+8"));System.out.println(time2);
以上就是直播app源码,JAVA8 时间格式转换, 更多内容欢迎关注之后的文章