Header Ads

  • Breaking Now

    Get Locale Specific Date


    import java.text.DateFormat;
    import java.util.Date;
    import java.util.Locale;


    public class LocaleDate {

    /**
    * @param args
    */
    public static void main(String[] args) {
    Locale americanLocale = new Locale("en", "US" );
    Locale germanLocale = new Locale("de", "DE");

    DateFormat americanFormat =
    DateFormat.getDateInstance(DateFormat.SHORT, americanLocale);
    DateFormat germanFormat =
    DateFormat.getDateInstance(DateFormat.SHORT, germanLocale);

    Date date = new Date();

    System.out.println(americanFormat.format(date));
    System.out.println(germanFormat.format(date));

    }

    }

    No comments

    Post Top Ad

    Post Bottom Ad