Here you can find the source of now(String dateFormat)
Parameter | Description |
---|---|
dateFormat | format of date to count |
public static String now(String dateFormat)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { /**//from w w w .j a v a 2 s . com * Returns actual time and/or date in specified format. * @param dateFormat format of date to count * @return actual time and/or date */ public static String now(String dateFormat) { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); return sdf.format(cal.getTime()); } }