Here you can find the source of getNowDateTime(String strScheme)
public static final String getNowDateTime(String strScheme)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String getNowDateTime(String strScheme) { String strReturn = null;//from ww w .j a va 2 s .c o m Date now = new Date(); try { SimpleDateFormat sdf = new SimpleDateFormat(strScheme); strReturn = sdf.format(now); } catch (Exception e) { strReturn = ""; } return strReturn; } public static final String getNowDateTime() { String strReturn = null; Date now = new Date(); try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); strReturn = sdf.format(now); } catch (Exception e) { strReturn = ""; } return strReturn; } }