Here you can find the source of now(String dateFormat)
Parameter | Description |
---|---|
dateFormat | a date format (See examples) |
public static String now(String dateFormat)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/* www. ja v a 2 s .c om*/ * Returns the current date in a given format. * eg.=> CLDateUtil.now("dd MMMMM yyyy") * @param dateFormat a date format (See examples) * @return the current formatted date/time * @author Sean Zheng * @CreateDate 2013-5-13 */ public static String now(String dateFormat) { SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); long now = System.currentTimeMillis(); return sdf.format(new Date(now)); } }