java实体类里的LocalDateTime怎么设置返回前端的时候值是时间戳?

java实体类里的LocalDateTime怎么设置返回前端的时候值是时间戳

LocalDateTime tt = LocalDateTime.now();
        ZoneId z = ZoneId.systemDefault();
        Instant i = tt.atZone(z).toInstant();
        long a = i.toEpochMilli();  //返回给前端时间戳

对哟,直接转成时间戳格式就好呀,或者simpleDateformat自己格式化想要的格式