Hey there! any question in your mind? Ask It Now!.

Popular Categories





Want to read localized data formats in Java.

0 votes
120 views
asked in Programming by jack (1,440 points)
Hello guys I am trying to get localized data pattern string, Here I know about how to format dates, some how I need pattern.
See my code I have format current date into short localize date: 
 
DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault());
String today = formatter.format(new Date());
Now I want to obtain the localize pattern string in some format lets say format is "mm/dd/yy" , I hope you got my question. Thanks For your answer!

 

1 Answer

0 votes
answered by jatin Expert (3,823 points)
 In Java 8 there is DateTimeFormatterBuilder you can use it like this:
 
  String dateDemo = DateTimeFormatterBuilder.getLocalizedDateTimePattern
  (FormatStyle.SHORT, null, IsoChronology.INSTANCE, Locale.GERMANY); 
  
  Another option is that you can use toLocalizedPattern()  for SimpleDateFormat .
  For info of toLocalizedPattern()
  
  I hope it may help you out.

Related Questions

+3 votes
1 answer 382 views
0 votes
0 answers 91 views
+1 vote
1 answer 816 views
+3 votes
1 answer 719 views
+2 votes
2 answers 796 views
–1 vote
0 answers 126 views
+8 votes
2 answers 125 views
0 votes
0 answers 161 views
asked in Programming by vimal jain

Not a Member yet?

Ask to Folks Login

My Account
787 Folks are online
0 members and 787 guest online
Your feedback is highly appreciated