First Thanks to Mr. Wayan Saryada for advice to Change Symbol of Currency Format. In this code snippet you will learn how to change Currency Symbol Locale by DecimalFormat. First Of All we need create an instance of object Locale (we use US Locale). Then make e object DecimalFormat using static method getCurrencyInstance. DecimalFormatSymbols is […]
Monthly Archive:: February 2015

How to Format Java LocalDate using Locale
Hii… This Code will show us how to format Java LocalDate. DateTimeFormatter will help to convert LocalDate to String.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.Locale; public class LocalDateFormatterMain { public static void main(String[] args) { //get date today LocalDate _now=LocalDate.now(); // DateTimeFormatter.ofPattern(PATTTERN_DATE, LOCALE ) Arrays.asList(Locale.getAvailableLocales()). forEach(locale->{ System.out.println("Locale "+locale.getDisplayCountry() +"\t Print Date \t: " +_now.format(DateTimeFormatter.ofPattern("EEEE , dd MMMM yyyy", locale))); }); } } |
Example Result we get is..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
Locale Taiwan Print Date : ??? , 02 ?? 2015 Locale Denmark Print Date : mandag , 02 februar 2015 Locale Puerto Rico Print Date : lunes , 02 febrero 2015 Locale Vietnam Print Date : Th? hai , 02 tháng hai 2015 Locale United States Print Date : Monday , 02 February 2015 Locale Sweden Print Date : måndag , 02 februari 2015 Locale Bolivia Print Date : lunes , 02 febrero 2015 Locale Singapore Print Date : Monday , 02 February 2015 Locale Print Date : Segunda-feira , 02 Fevereiro 2015 Locale Print Date : Pondelok , 02 februára 2015 Locale Print Date : Dé Luain , 02 Feabhra 2015 Locale Malta Print Date : Monday , 02 February 2015 Locale Finland Print Date : maanantai , 02 helmikuuta 2015 Locale Print Date : esmaspäev , 02 veebruar 2015 Locale Print Date : måndag , 02 februari 2015 Locale Print Date : Pond?lí , 02 února 2015 Locale Bosnia and Herzegovina Print Date : ponedeljak , 02 februar 2015 Locale Print Date : hétf? , 02 február 2015 Locale Switzerland Print Date : lundi , 02 février 2015 Locale Print Date : Senin , 02 Februari 2015 Locale Argentina Print Date : lunes , 02 febrero 2015 Locale El Salvador Print Date : lunes , 02 febrero 2015 Locale Czech Republic Print Date : Pond?lí , 02 února 2015 Locale Print Date : lunes , 02 febrero 2015 Locale Poland Print Date : poniedzia?ek , 02 lutego 2015 Locale Print Date : Pazartesi , 02 ?ubat 2015 Locale Spain Print Date : dilluns , 02 de febrer 2015 Locale Serbia and Montenegro Print Date : ????????? , 02 ??????? 2015 Locale Malaysia Print Date : Isnin , 02 Februari 2015 Locale Print Date : ponedjeljak , 02 velja?e 2015 Locale Print Date : Pirmadienis , 02 vasaris 2015 Locale Spain Print Date : lunes , 02 febrero 2015 Locale Colombia Print Date : lunes , 02 febrero 2015 Locale Print Date : e hënë , 02 shkurt 2015 Locale Print Date : lundi , 02 février 2015 Locale Print Date : mánudagur , 02 febrúar 2015 Locale Paraguay Print Date : lunes , 02 febrero 2015 Locale Print Date : Montag , 02 Februar 2015 Locale Ecuador Print Date : lunes , 02 febrero 2015 Locale United States Print Date : lunes , 02 febrero 2015 Locale Print Date : Monday , 02 February 2015 Locale Romania Print Date : luni , 02 februarie 2015 Locale Philippines Print Date : Monday , 02 February 2015 Locale Print Date : dilluns , 02 de febrer 2015 Locale Montenegro Print Date : ponedeljak , 02 februar 2015 Locale Guatemala Print Date : lunes , 02 febrero 2015 Locale Print Date : Ponedeljek , 02 februar 2015 Locale Mexico Print Date : lunes , 02 febrero 2015 Locale Honduras Print Date : lunes , 02 febrero 2015 Locale Hong Kong Print Date : ??? , 02 ?? 2015 Locale Norway Print Date : måndag , 02 februar 2015 Locale Hungary Print Date : hétf? , 02 február 2015 Locale Chile Print Date : lunes , 02 febrero 2015 Locale Print Date : maanantai , 02 helmikuuta 2015 Locale Turkey Print Date : Pazartesi , 02 ?ubat 2015 Locale Estonia Print Date : esmaspäev , 02 veebruar 2015 Locale Print Date : ponedeljak , 02 februar 2015 Locale Portugal Print Date : Segunda-feira , 02 Fevereiro 2015 Locale Luxembourg Print Date : lundi , Locale Germany Print Date : Montag , 02 Februar 2015 Locale Lithuania Print Date : Pirmadienis , 02 vasaris 2015 Locale Italy Print Date : lunedì , 02 febbraio 2015 Locale Indonesia Print Date : Senin , 02 Februari 2015 Locale United Kingdom Print Date : Monday , 02 February 2015 |

Java 8 LocalDate By Example
Java Util Date is Past, Now is a new Era, Java Time is a Future, my teacher say like that Java 8 come with the new Api for Date. LocalDate is an immutable date-time object that represents a date, often viewed as year-month-day. Other date fields, such as day-of-year, day-of-week and week-of-year, can also be […]