Java String to Timestamp timestamp(String string)

Here you can find the source of timestamp(String string)

Description

Prepend a timestamp to the string defined by parameter string

License

Open Source License

Parameter

Parameter Description
string the string

Return

the string data with a prepended timestamp

Declaration

public static String timestamp(String string) 

Method Source Code

//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;
    }
}

Related

  1. isTimestamp(String str, boolean allowEmpty)
  2. isTimeStampValid(String timestamp)
  3. string2Timestamp(String dateString, String timezone)
  4. string2timestamp(String timeString)
  5. stringToTimestamp(String date)
  6. timeStamp2Date(String timestampString)
  7. timeStampToDate(String timeStamp)
  8. toTimeStamp(String argS)
  9. toTimeStamp(String myDate, String pattern, Locale language)