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:
You can use method getDateTimeInstance
, of DateFormat
. Here the getDateTimeInstance
method takes 3 arguments
the Locale using which pattern is auto extracted
DATE_FORMAT = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.US);
System.out.println(DATE_FORMAT.format(d));
DATE_FORMAT = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.FRENCH);
System.out.println(DATE_FORMAT.format(d));