Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

Locale with SimpleDateFormat

Ads

 
 

Share on Google+Share on Google+

Kriti
Locale with SimpleDateFormat
2 Answer(s)      8 years ago
Posted in : Java Beginners
Ads
View Answers

July 2, 2009 at 11:25 AM


Hi Friend,

We are providing you a code that will display the current date in three different locales using SimpleDateFormat class.

By defining the locales, you can display the dates in different formats.If you instantiate SimpleDateFormat class without a Locale parameter, it will format the date according to the default Locale.

import java.text.*;
import java.util.*;

public class DateExample {

public static void main(String args[]) {

Locale[] locales = {Locale.UK, Locale.FRANCE, Locale.ITALIAN};
Date date = new Date();
String s;

for (int i = 0; i < locales.length; i++) {
s = SimpleDateFormat.getDateInstance(SimpleDateFormat.FULL,
locales[i]).format(date);
System.out.println(locales[i].getDisplayLanguage() + "\t : " + s);
}
}
}

Thanks


April 25, 2012 at 4:17 PM


Please include chinese also....


Ads









Related Tutorials/Questions & Answers:
Locale with SimpleDateFormat - Java Beginners
Locale with SimpleDateFormat  What does that mean when instantiating a SimpleDateFormat object,specify a locale? Its just a good programming... in different formats.If you instantiate SimpleDateFormat class without a Locale
SimpleDateFormat
SimpleDateFormat  Hi, What is the use of SimpleDateFormat class...;Hi, SimpleDateFormat is a class in Java API which comes with the default JDK... the date locale information is taken in consideration and this class is best
Advertisements
SimpleDateFormat parse example
SimpleDateFormat parse example  Hi, How to parse a date in Java program with the help of SimpleDateFormat class? Tell me how to parse following... = "10-Dec-2017"; String pattern = "dd-MMM-yyyy"; SimpleDateFormat
Locale class
Locale class  What is the Locale class
Java SimpleDateFormat Example
Java SimpleDateFormat Example In this section we will discuss about how... date format we may use the java.text.SimpleDateFormat class. SimpleDateFormat class is used to format and parse the date in the locale-sensitive mode
Java Locale
Java Locale  How will you load a specific locale?   Hi Friend, A locale is the part of a user's environment that brings together.../java/javadate/locale-format.shtml http://www.roseindia.net/tutorial/java
Formatting and Parsing a Date for a Locale
locale = Locale.FRENCH; Format f = new SimpleDateFormat("MMMM d,yyyy...Formatting and Parsing a Date for a Locale In this section, you will learn how to format and parse a date for a locale. Java has provide the utility
What is the Locale class?
What is the Locale class?  What do you understand about locale class in java program. thanks,   Hi, The Locale class in Java is Java... region. IN Java computing, locale describes a set of parameters to classify
Formatting Date for a Locale Example
Formatting Date for a Locale Example  ... SimpleDateFormat class. In this program we are format date for different locales. Description of the code : SimpleDateFormat() : SimpleDateFormat class
JSP Locale
JSP Locale          JSP Locale is used to get the preferred locale of the user. A user can configure their browser with a US language locale ("en
What is Locale - Java Beginners
What is Locale  Hi, What is Locale? Write example to show the use of Locale. Thanks   Hi Friend, A locale is the part... the following links: http://www.roseindia.net/java/javadate/locale-format.shtml http
Java get System Locale
Java get System Locale       In this section, you will learn how to obtain the locale. We are providing you an example which will obtain the locale of the system
Java Locale
Java Locale         A locale class in java api represents a specific geographical, political, or cultural region. In java computing, locale defines a set of parameters
Java Set Default Locale
Java Set Default Locale       Setting Default Locale Example in Java Locale can be set also in our java programs by using the method setDefault() of Locale class
Version of com.logicartisan>common-locale dependency
List of Version of com.logicartisan>common-locale dependency
Version of com.logicartisan>common-locale dependency
List of Version of com.logicartisan>common-locale dependency
<html:html locale="true">
  <%@ taglib uri="/tags/struts-bean" prefix="bean" %> <%@ taglib uri="/tags/struts-html" prefix="html" %> <%@ taglib uri="/tags/struts-logic" prefix="logic" %> <html:html locale="true"> <
Setting the default Locale
Setting the default Locale       This section shows you how to set the default locale. Example presented in the section, illustrates you how to get and set the default locale
Java get default Locale
Java get default Locale       Locale object is a representation of geographical, political, or cultural region. We can get and set our default locale through the java programs
Java get System Locale
Java get System Locale       In this section, you will learn how to obtain the locale. We are providing you an example which will obtain the locale of the system by using
Formatting and Parsing a Number for a Locale
Formatting and Parsing a Number for a Locale In this section, you will learn how to format and parse a number for a Locale. Formatting converts a date, time... to the specified locale by invoking the methods of these classes. Here we are going
Formatting and Parsing a Time for a Locale
Formatting and Parsing a Time for a Locale In this section, you will learn how to format and parse a time for a locale. Java has provide several classes.... This class formats and parses both date and time for any locale. To format
Version of xdoclet>xdoclet-de-locale dependency
List of Version of xdoclet>xdoclet-de-locale dependency
Version of com.cloudhopper>ch-commons-locale dependency
List of Version of com.cloudhopper>ch-commons-locale dependency
Formatting number as per specific locale in java
Formatting number as per specific locale in java  Hi, I am trying to print the number as per locale. I tried below, but it still prints in English locale. public class loctest { public static void main(String[] args
Maven Dependency common-locale >> 1.0.0
You should include the dependency code given in this page to add Maven Dependency of com.logicartisan >> common-locale version1.0.0 in your project
Formatting and Parsing a Locale-Specific Percentage
Formatting and Parsing a Locale-Specific Percentage In this section, you will learn how to format and parse a locale-specific percentage. On the basis... are going to format a number into locale specific percentage using NumberFormat class
Change language according to the locale
Change language according to the locale  ... language according to the locale. In the code given below we have changed language according to the locale. Methods used in this example are described below
Formatting and Parsing Locale-Specific Currency
Formatting and Parsing Locale-Specific Currency In this section, you will learn how to format and parse the locale specific currency. Through the formatting... are going to format the number into locale specific currency using NumberFormat class
Version of xdoclet>xdoclet-fr_FR-locale dependency
List of Version of xdoclet>xdoclet-fr_FR-locale dependency
Version of xdoclet>xdoclet-pt_BR-locale dependency
List of Version of xdoclet>xdoclet-pt_BR-locale dependency