Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { static public String formatDate(Date baseDate, String dateFormat) { SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); return sdf.format(baseDate); } }