Java Locale Format formatDate(String strDate, Locale locale)

Here you can find the source of formatDate(String strDate, Locale locale)

Description

format Date

License

Open Source License

Declaration

public static String formatDate(String strDate, Locale locale) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static String formatDate(String strDate, Locale locale) {
        String ret = "";
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
        Date date = null;//from  w  w w .  j av a  2s .  co  m
        try {
            date = sdf.parse(strDate);
        } catch (Exception e) {
            return ret;
        }

        DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, locale);
        ret = df.format(date);

        return ret;
    }
}

Related

  1. formatDate(java.util.Date d, String format)
  2. formatDate(java.util.Date date, String formatPattern)
  3. formatDate(String _Date)
  4. formatDate(String dateStr, String format, String toFormat)
  5. formatDate(String pattern, Date date, String valueForNull)
  6. formatDate(String value, Locale locale)
  7. formatDate2Date(Date date, String format)
  8. formatDate2String(Date date, String format)
  9. formatDateByFormat(Date date, String format)