get Current Time Timestamp - Java java.sql

Java examples for java.sql:Timestamp

Description

get Current Time Timestamp

Demo Code

/**//  w ww. j  ava 2 s.  c  o m
 * <p>Project: fsp</p>
 * <p>Title: Constants.java</p>
 * <p>Description: </p>
 * <p>Copyright (c) 2014 Sunlights.cc</p>
 * <p>All Rights Reserved.</p>
 *
 * @author <a href="mailto:zhencai.yuan@sunlights.cc">yuanzhencai</a>
 */
//package com.java2s;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Locale;

public class Main {
    public static Timestamp getCurrentTime() {
        long time = Calendar.getInstance(Locale.CANADA).getTime().getTime();
        return new Timestamp(time);
    }
}

Related Tutorials