Here you can find the source of getTime(String pattern)
public static String getTime(String pattern)
//package com.java2s; /******************************************************************************* * ------------------------------------------------------------------------- * * The software in this package is published under the terms of the NCI * style * license a copy of which has been included with this distribution in * the * LICENSE.txt file. * */*from ww w. j a v a 2 s .c om*/ ******************************************************************************/ import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getTime(String pattern) { Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(now); } public static String getTime() { Long reVar = new Long(new Date().getTime()); return reVar.toString(); } }