Here you can find the source of getCurrentTimestamp()
public static Timestamp getCurrentTimestamp()
//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(); } }