Here you can find the source of now(String dateFormat)
Parameter | Description |
---|---|
dateFormat | a parameter |
public static String now(String dateFormat)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; /**/*from ww w . j av a 2 s . c om*/ * Trasnforms String --> * @param dateFormat * @return */ public static String now(String dateFormat) { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); return sdf.format(cal.getTime()); } public static String now() { return now(DATE_FORMAT_NOW); } }