Here you can find the source of nowDate(final String formatter)
public static Date nowDate(final String formatter)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date nowDate(final String formatter) { String str = ""; final SimpleDateFormat sdf = new SimpleDateFormat(formatter); Date date = new Date(); try {//from w w w.j a v a 2s . c o m str = sdf.format(date); date = sdf.parse(str); } catch (final ParseException e) { e.printStackTrace(); } return date; } }