Here you can find the source of date2Str(Date date, String partten)
public static String date2Str(Date date, String partten)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static SimpleDateFormat df = new SimpleDateFormat(); public static String date2Str(Date date, String partten) { String result = null;//w w w. j a va 2 s . c o m df.applyPattern(partten); result = df.format(date); return result; } }