Java Timestamp Now getCurrentTimestamp()

Here you can find the source of getCurrentTimestamp()

Description

get Current Timestamp

License

Apache License

Declaration

public static Timestamp getCurrentTimestamp() 

Method Source Code


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

import java.sql.Timestamp;

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

import java.util.TimeZone;

public class Main {
    public static final String DEFAULT_TIMEZONE = "Aisa/Shanghai";

    public static Timestamp getCurrentTimestamp() {
        return new Timestamp(getDate().getTime());
    }//from  ww w. j  a va 2 s.co  m

    public static Date getDate() {
        TimeZone tz = TimeZone.getTimeZone(DEFAULT_TIMEZONE);
        Calendar calendar = Calendar.getInstance(tz);
        return calendar.getTime();
    }
}

Related

  1. getCurrentTimeStamp()
  2. getCurrentTimeStamp()
  3. getCurrentTimeStamp()
  4. getCurrentTimestamp()
  5. getCurrentTimestamp()
  6. getCurrentTimeStamp()
  7. getCurrentTimestamp()
  8. getCurrentTimeStamp()
  9. getCurrentTimestamp()