Here you can find the source of getTime(String parrten)
public static String getTime(String parrten)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; public class Main { public static String getTime(String parrten) { String timestr;//ww w .j a va2 s. c om if (parrten == null || parrten.equals("")) { parrten = "yyyyMMddHHmmss"; } java.text.SimpleDateFormat sdf = new SimpleDateFormat(parrten); java.util.Date cday = new java.util.Date(); timestr = sdf.format(cday); return timestr; } }