Here you can find the source of nowTime(String formartStr)
public static String nowTime(String formartStr)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String nowTime(String formartStr) { String strDate = null;/* w w w . jav a 2s. c om*/ if ((formartStr != null) && (!"".equals(formartStr))) { SimpleDateFormat sdf = new SimpleDateFormat(formartStr); strDate = sdf.format(new Date()); } return strDate; } }