Here you can find the source of Now(String time)
public static String Now(String time)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String Now(String time) { SimpleDateFormat formatter = new SimpleDateFormat( "yyyyMMdd hhmmss"); SimpleDateFormat formatter2 = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); Date curDate;/*from w w w . j a va2s.com*/ try { curDate = formatter.parse(time); return formatter2.format(curDate); } catch (ParseException e) { e.printStackTrace(); return formatter2.format(System.currentTimeMillis()); } } /** * * @param src * @param objects * @return */ public static String format(String src, Object... objects) { int k = 0; for (Object obj : objects) { src = src.replace("{" + k + "}", obj.toString()); k++; } return src; } }