How can I get Date in MM/DD/YY format from Timestamp

后端 未结 7 1184
暗喜
暗喜 2020-12-16 11:27

I want to get the Date in MM/DD/YY format from a timestamp.

I have used the below method but it does not gives proper output

final Calen         


        
7条回答
  •  無奈伤痛
    2020-12-16 12:04

            Date date = new Date(System.currentTimeMillis());
        SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yy");
        String s = formatter.format(date);
        System.out.println(s);
    

提交回复
热议问题