java日期格式转换

public class LoopRead { 
    public static void main(String[] args) { 
        loopRead();
    }
    public static void loopRead(){ 
        long timeMillis = System.currentTimeMillis();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        for (int i = 1; i < 30; i++) { 
            long dateTime = timeMillis - (86400000l * i);
            Date date = new Date();
            date.setTime(dateTime);
            String dateString = dateFormat.format(date);
            System.out.println(dateString);
        }
    }
}
    原文作者:生吃小瓜子
    原文地址: https://blog.csdn.net/weixin_48960305/article/details/122448426
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞