Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String getDate(String format) throws Exception { SimpleDateFormat fm = new SimpleDateFormat(format); return fm.format(new Date()); } }