Timestamp before Minutes - Java java.sql

Java examples for java.sql:Timestamp

Description

Timestamp before Minutes

Demo Code

/**//from   ww  w  .  ja v a2 s  .com
 * <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;

public class Main {
    private static final long ONE_MINUTE = 60000;

    public static Timestamp beforeMinutes(Timestamp date, long min) {
        long fTime = date.getTime() - min * ONE_MINUTE;
        return new Timestamp(fTime);
    }
}

Related Tutorials