Here you can find the source of formatDate(final Date date, final String datepattern, TimeZone tz)
Parameter | Description |
---|---|
date | Date |
datepattern | String |
tz | TimeZone |
public static String formatDate(final Date date, final String datepattern, TimeZone tz)
//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); } }