世界中の時間変換処理方法

 @RequestMapping("test")
    public void test(){
        TimeZone timeZone = TimeZone.getTimeZone("Asia/Shanghai");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        sdf.setTimeZone(timeZone);
        String str=sdf.format(new Date(System.currentTimeMillis()));
        System.out.println(str);
    }

 

おすすめ

転載: blog.csdn.net/Skyline_ding/article/details/83013723