Localized date format in Java

前端 未结 6 1189
夕颜
夕颜 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:33

    But it does not show the hour. How can I do it?

    You have to call DateFormat.getDateTimeInstance(int, int, Locale)

    DateFormat.getDateInstance(int, Locale) => Gets the date formatter with the given formatting style for the given locale.

    While

    DateFormat.getDateTimeInstance(int, int, Locale) => Gets the date/time formatter with the given formatting styles for the given locale.

提交回复
热议问题