Here you can find the source of getTimeStamp(Date date)
public static String getTimeStamp(Date date)
//package com.java2s; /*//from w w w. j av a 2s. c o m * JLib - Publicitas Java library v1.2.0. * * Copyright (c) 2005, 2006, 2007, 2008, 2009 Publicitas SA. * Licensed under LGPL (LGPL-LICENSE.txt) license. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { private String format = "yyyy.MM.dd HH:mm:ss"; public static String getTimeStamp() { Date date = new Date(); return getTimeStamp(date); } public static String getTimeStamp(Date date) { SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); String cs = formatter.format(date); return cs; } }