Here you can find the source of getTime(int format)
public static String getTime(int format)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final SimpleDateFormat FORMAT4NAME = new SimpleDateFormat("yyyyMMddHHmmss"); private static final SimpleDateFormat FORMAT4LOG = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static String getTime(int format) { if (format == 0) { return FORMAT4NAME.format(new Date()); } else {//from www . j ava 2s. co m return FORMAT4LOG.format(new Date()); } } }