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

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

Description

format

License

Apache License

Declaration

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

Method Source Code

//package com.java2s;
/*//from   w  w  w. j a v  a2  s.  c o  m
 * Copyright (C) 2008 feilong (venusdrogon@163.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

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

public class Main {

    public static String format(Date date, String pattern) {
        return format(date, pattern, Locale.getDefault());
    }

    public static String format(Date date, String pattern, Locale locale) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern, locale);
        String format = simpleDateFormat.format(date);
        return format;
    }
}

Related

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