import java.util.Calendar;
import java.util.Date;
public class Sample {
public static void main(String[] args) {
final long ONE_MINUTE_IN_MILLIS=60000;//millisecs
Calendar date = Calendar.getInstance();
long t= date.getTimeInMillis();
Date afterAddingTenMins=new Date(t + (10 * ONE_MINUTE_IN_MILLIS));
System.out.println("before add:"+new Date());
System.out.println("after add:"+afterAddingTenMins);
}
}
output:
----------
before add:Fri Sep 02 12:43:02 EST 2016
after add:Fri Sep 02 12:53:02 EST 2016
No comments:
Post a Comment