Home java DateFormat in java

DateFormat in java




How can I withdraw the date to bring in Ukrainian in the console?

Answer 1, Authority 100%

Using Java 8 Date and Time API:

Public Static Void Main (String [] Args) {
  String a = "22-Serpnya-2015 22:25:36";
  Locale Loc_UKR = NEW Locale ("UK", "UA");
  DateTimeFormatter DTF = datetimeformatter.ofpattern ("DD-MMMM-YYYY HH: MM: SS", LOC_UKR);
  System.Out.PrintLN (DTF.PARSE (A.TolowerCase ()). Tostring ());


{}, ISO resolved to 2015-08-22t22: 25: 36

Do not forget that the Pattern is sensitive to register and without a.tolowerCase () will not boost.

Answer 2

IMHO, you need to create your own locale, and dig in the DateFormatsymbols, because This class gives information about the format of numbers, dates, etc.

Locale class simply stores information about Locale (country, language).

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions