Here you can find the source of getNow(boolean ifdatetime)
public static String getNow(boolean ifdatetime)
//package com.java2s; //License from project: Apache License public class Main { /**//from w w w. j a v a2s . c o m * yyyy-MM-dd */ public static final String DATE_FORMAT = "yyyy-MM-dd"; /** * yyyy-MM-dd HH:mm:ss */ public static final String STRING_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static String getNow(boolean ifdatetime) { java.util.Date dd = new java.util.Date(); java.text.SimpleDateFormat df = null; String rtn = ""; if (ifdatetime) { df = new java.text.SimpleDateFormat(STRING_DATE_FORMAT); } else { df = new java.text.SimpleDateFormat(DATE_FORMAT); } rtn = df.format(dd); return rtn; } }