Localized date format in Java

前端 未结 6 1185
夕颜
夕颜 2020-12-11 21:08

I have a timestamp in millis and want to format it indicating day, month, year and the hour with minutes precission.

I know I can specify the format like this:

6条回答
  •  Happy的楠姐
    2020-12-11 21:29

    Try some thing like this

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yy HH:mm", Locale.getDefault());
        String formatted = simpleDateFormat.format(900000);
        System.out.println(simpleDateFormat.parse(formatted));
    

提交回复
热议问题