Java tutorial
//package com.java2s; import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final NumberFormat format = new DecimalFormat("00"); public static String getDateRepresentation(Date date) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MMM-dd hh:mm:ss a"); return formatter.format(date); } }