Java Timestamp Create toTimestamp(final String pValue)

Here you can find the source of toTimestamp(final String pValue)

Description

Converts the string to a jdbc Timestamp, using the standard Timestamp escape format.

License

Open Source License

Parameter

Parameter Description
pValue the value

Return

a new Timestamp

Declaration

public static Timestamp toTimestamp(final String pValue) 

Method Source Code

//package com.java2s;

import java.sql.Timestamp;

public class Main {
    /**/*from w  w w . j av  a2 s  .c o m*/
     * Converts the string to a jdbc Timestamp, using the standard Timestamp
     * escape format.
     *
     * @param pValue the value
     * @return a new {@code Timestamp}
     * @see java.sql.Timestamp
     * @see java.sql.Timestamp#valueOf(String)
     */
    public static Timestamp toTimestamp(final String pValue) {
        // Parse date using default format
        return Timestamp.valueOf(pValue);
    }

    /**
     * Returns the value of the given {@code Object}, as a {@code String}.
     * Unlike String.valueOf, this method returns {@code null}
     * instead of the {@code String} "null", if {@code null} is given as
     * the argument.
     *
     * @param pObj the Object to find the {@code String} value of.
     * @return the String value of the given object, or {@code null} if the
     *         {@code pObj} == {@code null}.
     * @see String#valueOf(Object)
     * @see String#toString()
     */
    public static String valueOf(Object pObj) {
        return ((pObj != null) ? pObj.toString() : null);
    }
}

Related

  1. toTimestamp(DateTime dt)
  2. toTimestamp(final Calendar cal)
  3. toTimestamp(final Instant instant)
  4. toTimestamp(final int year, final int month, final int dayOfMonth, final int hour, final int minute, final int second, final int millsecond)
  5. toTimestamp(final java.sql.Date date)
  6. toTimestamp(java.sql.Date date)
  7. toTimestamp(long ts)
  8. toTimestamp(long value)
  9. toTimestamp(Object dateobj)