Here you can find the source of formatSpaydDate(Date date, TimeZone tz)
public static String formatSpaydDate(Date date, TimeZone tz) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { private static DateFormat dateFormat = null; public static String formatSpaydDate(Date date, TimeZone tz) throws ParseException { if (date == null) { return null; }//from ww w.j a v a2 s .c o m if (dateFormat == null) { dateFormat = new SimpleDateFormat("yyyyMMdd"); } if (tz != null) { dateFormat.setTimeZone(tz); } else { dateFormat.setTimeZone(TimeZone.getDefault()); } return dateFormat.format(date); } }