Java Utililty Methods Timestamp Convert To

List of utility methods to do Timestamp Convert To

Description

The list of methods to do Timestamp Convert To are organized into topic(s).

Method

BigIntegerTimestampToBigint(String timestamp)
Convert a string timestamp value to big integer.
BigInteger result = BigInteger.valueOf(new Long(Timestamp.valueOf(timestamp).getTime()));
return result;
byte[]timeStampToBytes(Timestamp ts)
time Stamp To Bytes
Calendar cal = Calendar.getInstance();
cal.setTime(ts);
byte[] b = new byte[12];
b[0] = (byte) 0;
b[1] = (byte) (cal.get(Calendar.YEAR) & 0xff);
b[2] = (byte) (cal.get(Calendar.YEAR) >>> 8);
b[3] = (byte) (cal.get(Calendar.MONTH) & 0xff);
b[4] = (byte) (cal.get(Calendar.DATE) & 0xff);
...
java.util.CalendartimestampToCalendar(java.sql.Timestamp inTime)
Returns Calendar converted from Timestamp.
if (inTime == null) {
    return (null);
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.setTime(inTime);
return (cal);
CalendartimestampToCalendar(Timestamp time)
Converts Timestamps to Calendars.
Calendar cal = new GregorianCalendar();
cal.setTime(time);
return cal;
DateTimestampToDate(Integer time)
Timestamp To Date
long temp = (long) time * 1000;
Timestamp ts = new Timestamp(temp);
Date date = new Date();
try {
    date = ts;
} catch (Exception e) {
    e.printStackTrace();
return date;
java.util.DatetimestampToDate(java.sql.Timestamp ts)
Convers a SQL timestamp to a Date
if (ts == null) {
    return null;
Date d = new Date(ts.getTime());
return d;
DatetimeStampToDate(Timestamp tim)
time Stamp To Date
return timeStampToCal(tim).getTime();
DatetimestampToDate(Timestamp tt)
timestamp To Date
return new Date(tt.getTime());
StringTimestampToDateStr(Timestamp tmp)
Timestamp To Date Str
return SHORT_DATE_FORMAT.format(tmp);
StringtimestampToDateString(Timestamp ts)
timestamp To Date String
String tsStr = "";
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
tsStr = sdf.format(ts);
return tsStr;