Java tutorial
import java.util.Calendar; public class Main { public static void main(String[] args) { Calendar now = Calendar.getInstance(); // add seconds to current date now.add(Calendar.SECOND, 500); System.out.println("adding 500 seconds : "); System.out.println(now.get(Calendar.MINUTE) + ":" + now.get(Calendar.SECOND)); // adding minus value now = Calendar.getInstance(); now.add(Calendar.SECOND, -500); System.out.println("adding -500 seconds: "); System.out.println(now.get(Calendar.MINUTE) + ":" + now.get(Calendar.SECOND)); } }