Here you can find the source of now()
Parameter | Description |
---|---|
f | a parameter |
format | a parameter |
public static String now()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { private static final String DEFAULT_TSFORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; /**// w ww. j a v a 2 s . c om * @param f * @param format * @return */ public static String now() { return now(DEFAULT_TSFORMAT); } public static String now(String format) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis()); SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(cal.getTime()); } }