Java Timestamp Now getTimestamp()

Here you can find the source of getTimestamp()

Description

get Timestamp

License

Open Source License

Declaration

public static Timestamp getTimestamp() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Timestamp;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Timestamp getTimestamp() {
        return toTimestamp(getSqlDate());
    }/* ww  w  . ja  v a2s.c o m*/

    public static Timestamp toTimestamp(java.sql.Date date) {
        if (date == null) {
            return null;
        }

        return new Timestamp(date.getTime());
    }

    public static java.sql.Date getSqlDate() {
        return new java.sql.Date(getDate().getTime());
    }

    private static Date getDate() {
        return Calendar.getInstance().getTime();
    }
}

Related

  1. getNowTimeStamp()
  2. getTimestamp()
  3. getTimestamp()
  4. getTimestamp()
  5. getTimestamp()
  6. getTimeStamp()
  7. getTimeStamp()
  8. getTimestamp()
  9. getTimestamp()