Java Timestamp Create getTimestamp(long time)

Here you can find the source of getTimestamp(long time)

Description

Convert a millisecond value to a Timestamp.

License

Apache License

Parameter

Parameter Description
time millsecond value

Return

Timestamp

Declaration

public static java.sql.Timestamp getTimestamp(long time) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Timestamp;

public class Main {
    /**/*ww w  .  j a v  a2 s .  com*/
     * Convert a millisecond value to a Timestamp.
     * @param time millsecond value
     * @return Timestamp
     */
    public static java.sql.Timestamp getTimestamp(long time) {
        return new java.sql.Timestamp(time);
    }

    /**
     * Convert a millisecond value to a Timestamp.
     * @param milliSecs millsecond value
     * @return Timestamp
     */
    public static Timestamp getTimestamp(String milliSecs) throws NumberFormatException {
        return new Timestamp(Long.parseLong(milliSecs));
    }
}

Related

  1. getTimestamp(final LocalDate date)
  2. getTimestamp(final Map map, final Object key)
  3. getTimestamp(int offset)
  4. getTimestamp(int year, int month, int day, int hour, int min, int second)
  5. getTimestamp(java.util.Date utilDate)
  6. getTimestamp(Object o)
  7. getTimestamp(Object value)
  8. getTimestamp(Object value, int columnType)
  9. getTimestamp(ResultSet rs, String colName)