List of usage examples for java.util Calendar SECOND
int SECOND
To view the source code for java.util Calendar SECOND.
Click Source Link
get
and set
indicating the second within the minute. From source file:Main.java
public static Calendar getDate(Calendar calendar) { Calendar cal = (Calendar) calendar.clone(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0);//from ww w. j av a 2s. c om cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal; }
From source file:Main.java
public static String getStringTime() { Calendar c = Calendar.getInstance(Locale.ITALY); return c.get(Calendar.HOUR_OF_DAY) + ":" + c.get(Calendar.MINUTE) + ":" + c.get(Calendar.SECOND); }
From source file:Main.java
public static Calendar clearTime(Calendar calendar) { calendar.clear(Calendar.HOUR_OF_DAY); calendar.clear(Calendar.HOUR); calendar.clear(Calendar.MINUTE); calendar.clear(Calendar.SECOND); calendar.clear(Calendar.MILLISECOND); return calendar; }
From source file:Main.java
public static void copyTime(Calendar dest, Calendar src) { dest.set(Calendar.HOUR_OF_DAY, src.get(Calendar.HOUR_OF_DAY)); dest.set(Calendar.MINUTE, src.get(Calendar.MINUTE)); dest.set(Calendar.SECOND, src.get(Calendar.SECOND)); dest.set(Calendar.MILLISECOND, src.get(Calendar.MILLISECOND)); }
From source file:Main.java
public static int getSec(Date date) { return getCalendar(date).get(Calendar.SECOND); }
From source file:Main.java
public static Date addSeconds(Date date, Integer seconds) { Calendar cal = Calendar.getInstance(); cal.setTime(date);//from w ww .j a v a2 s .c om cal.add(Calendar.SECOND, seconds); return cal.getTime(); }
From source file:Main.java
public static int getSecond(Date date) { calendar = Calendar.getInstance(); calendar.setTime(date);/*from ww w .j a va 2 s . com*/ return calendar.get(Calendar.SECOND); }
From source file:Main.java
public static Calendar getCurrentDateWithoutTime() { Calendar cal = Calendar.getInstance(); // locale-specific cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0);//from ww w .j a v a2s . c om cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal; }
From source file:Main.java
public static int daysSince(final long date) { final Calendar logDate = Calendar.getInstance(); logDate.setTimeInMillis(date);/* w w w.ja va 2 s. co m*/ logDate.set(Calendar.SECOND, 0); logDate.set(Calendar.MINUTE, 0); logDate.set(Calendar.HOUR_OF_DAY, 0); final Calendar today = Calendar.getInstance(); today.set(Calendar.SECOND, 0); today.set(Calendar.MINUTE, 0); today.set(Calendar.HOUR_OF_DAY, 0); return (int) Math.round((today.getTimeInMillis() - logDate.getTimeInMillis()) / 86400000d); }
From source file:Main.java
public static Calendar today() { Calendar date = new GregorianCalendar(); date.set(Calendar.HOUR_OF_DAY, 0); date.set(Calendar.MINUTE, 0); date.set(Calendar.SECOND, 0); date.set(Calendar.MILLISECOND, 0); return date;//from w w w . j av a 2 s. c o m }