Here you can find the source of timestamp(Date dateAndTime)
Thursday, May 29, 2003 11:42:44 AM
static public String timestamp(Date dateAndTime)
//package com.java2s; /* The DateUtil utility provides several workhorse methods that * use Java's formatters to parse and format dates, times, etc. * * <!-- ====================== distribution terms ===================== --> * <p><blockquote//from w ww . ja va 2 s . co m * style="border-style: solid; border-width:thin; padding: 1em 1em 1em 1em;"> * <center> * Copyright © 2003, Allen I. Holub. All rights reserved. * </center> * <br> * <br> * This code is distributed under the terms of the * <a href="http://www.gnu.org/licenses/gpl.html" * >GNU Public License</a> (GPL) * with the following ammendment to section 2.c: * <p> * As a requirement for distributing this code, your splash screen, * about box, or equivalent must include an my name, copyright, * <em>and URL</em>. An acceptable message would be: * <center> * This program contains Allen Holub's <em>XXX</em> utility.<br> * (c) 2003 Allen I. Holub. All Rights Reserved.<br> * http://www.holub.com<br> * </center> * If your progam does not run interactively, then the foregoing * notice must appear in your documentation. * </blockquote> * <!-- =============================================================== --> * @author Allen I. Holub */ import java.text.*; import java.util.*; public class Main { /** Return a string holding the time and date in the form: * <pre> * Thursday, May 29, 2003 11:42:44 AM * </pre> */ static public String timestamp(Date dateAndTime) { return DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM).format(dateAndTime); } }