Java Locale Format formatDate(final Date date, final String datepattern, TimeZone tz)

Here you can find the source of formatDate(final Date date, final String datepattern, TimeZone tz)

Description

getDateCUBRIDString

License

Open Source License

Parameter

Parameter Description
date Date
datepattern String
tz TimeZone

Return

String

Declaration

public static String formatDate(final Date date,
        final String datepattern, TimeZone tz) 

Method Source Code

//package com.java2s;
import java.text.DateFormat;

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

public class Main {
    /**/*from  w  ww.ja  v  a2s.  co m*/
     * getDateCUBRIDString
     * 
     * @param date Date
     * @param datepattern String
     * @param tz TimeZone
     * @return String
     */
    public static String formatDate(final Date date,
            final String datepattern, TimeZone tz) {
        final DateFormat formatter = new SimpleDateFormat(datepattern,
                Locale.US);
        formatter.setTimeZone(tz);
        formatter.setLenient(false);
        return formatter.format(date);
    }
}

Related

  1. formatDate(Date date, String pattern)
  2. formatDate(Date date, String pattern, Locale locale)
  3. formatDate(Date date, String pPatern)
  4. formatDate(Date value, String pattern, TimeZone tz)
  5. formatDate(final Date dat, final String pattern)
  6. formatDate(final Date date, final String format)
  7. formatDate(final Date date, final String pattren)
  8. formatDate(java.util.Date d, String format)
  9. formatDate(java.util.Date d, String format)