Reputation: 675
Using this code:
DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.FULL, new Locale("no")).format(Date);
Date 3 AM CST 12 DEC 16
would have a result of: 12. desember 2016 kl 03.00 CST
But what if I only want to show the hours in the time format and remove the minutes and seconds if ever it was present on other locales?
Expecting a result of 12. desember 2016 kl 03 CST
or if using English locale then should only be December 12, 2016 3 AM CST
Upvotes: 0
Views: 273
Reputation: 5712
How about having a SimpleDateFormatter
like below:
SimpleDateFormat dateFormat = new SimpleDateFormat("dd. MMMMM yyyy aa hh z", new Locale("no"));
System.out.println(dateFormat.format(new Date()));
Upvotes: 1