Here you can find the source of timestamp(String string)
string
Parameter | Description |
---|---|
string | the string |
public static String timestamp(String string)
//package com.java2s; /* IBS AB ************************************************** * * (C) Copyright IBS AB. 2000 - All Rights Reserved * * The original version of this source code and documentation is copyrighted * and owned by IBS AB AB. This notice may not be removed. * * Using, copying or modifying, restricted by license agreement with IBS AB * * IBS AB MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT * NOT LIMITED TO THE FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. * IBS AB SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE * OR ITS DERIVATIVES.//from www . ja v a2 s . c o m * **************************************************************************/ import java.text.*; import java.util.*; public class Main { /** * Prepend a timestamp to the string defined by parameter <code>string</code> * * @param string the string * @return the string data with a prepended timestamp */ public static String timestamp(String string) { String formattedString = DateFormat.getDateTimeInstance().format( Calendar.getInstance().getTime()) + " " + string; return formattedString; } }