Java examples for java.util:Second
Creates a calendar that represents the date offset seconds from now.
//package com.java2s; import java.util.Calendar; public class Main { public static void main(String[] argv) throws Exception { int offset = 2; System.out.println(createCalendar(offset)); }/*from ww w .ja v a 2 s . c o m*/ /** * Creates a calendar that represents the date offset seconds from now. * * @param offset * offset in seconds * @return the new calendar */ public static Calendar createCalendar(int offset) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.SECOND, offset); return calendar; } }