Java Utililty Methods Calendar Time

List of utility methods to do Calendar Time

Description

The list of methods to do Calendar Time are organized into topic(s).

Method

longtoUnixTime(Calendar timestamp)
Convert from a Java Calendar instance into a Unix Time stamp.
return timestamp.getTimeInMillis() / 1000L;
voidtoVonTime(final Calendar cal)
to Von Time
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
CalendarunixToCalendar(long unixTime)
Converts Unix time to Calendar instance.
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(unixTime);
return calendar;
CalendarzeroTime(Calendar cal)
zero Time
cal.set(Calendar.HOUR, 0);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal;
voidzeroTimeFields(Calendar cal)
sets hours/minutes/seconds/milliseconds to 0
cal.set(Calendar.HOUR, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
cal.getTimeInMillis();