Localized date format in Java

前端 未结 6 1190
夕颜
夕颜 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条回答
  •  不知归路
    2020-12-11 21:41

    You can use something like this:

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

提交回复
热议问题