Java Locale Format format(Date date, String format, Locale locale)

Here you can find the source of format(Date date, String format, Locale locale)

Description

Format date to String.

License

Open Source License

Parameter

Parameter Description
date the date
format the format
locale the locale

Return

the string

Declaration

public static String format(Date date, String format, Locale locale) 

Method Source Code


//package com.java2s;
/*/*  w ww  .j ava  2  s.  c  om*/
 * Copyright(C) 2016 thuebannhadat.com.vn. All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * thuebannhadat.com.vn. You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the license
 * agreement you entered into with thuebannhadat.com.vn.
 */

import java.text.SimpleDateFormat;

import java.util.Date;
import java.util.Locale;

public class Main {
    /**
     * Format date to String.
     *
     * @param date
     *            the date
     * @param format
     *            the format
     * @param locale
     *            the locale
     * @return the string
     */
    public static String format(Date date, String format, Locale locale) {

        if (date != null && format != null && locale != null) {
            return new SimpleDateFormat(format, Locale.ENGLISH).format(date);
        }
        return null;
    }
}

Related

  1. format(Date d, Locale locale)
  2. format(Date d, String format)
  3. format(Date date)
  4. format(Date date)
  5. format(Date date, String format)
  6. format(Date date, String parttern)
  7. format(Date date, String pattern)
  8. format(Date date, String pattern)
  9. format(Date date, String pattern, Locale locale)