org.ijsberg.iglu.util.time
Class TimeSupport

java.lang.Object
  extended by org.ijsberg.iglu.util.time.TimeSupport
Direct Known Subclasses:
SchedulingSupport

public abstract class TimeSupport
extends Object

Contains convenience methods concerning time, date and scheduling.


Field Summary
static int DAY_IN_MINS
           
static int DAY_IN_MS
           
static int HALF_MINUTE_IN_MS
           
static int HOUR_IN_MS
           
static long LOCAL_UTC_OFFSET
           
static long LOCAL_UTC_OFFSET_IN_MINUTES
           
static int MINUTE_IN_MS
           
static int SECOND_IN_MS
           
 
Constructor Summary
TimeSupport()
           
 
Method Summary
static int getMinutesSinceMidnight()
           
static int getMinutesSinceMidnight(long time)
           
static long getUtcOffset(Calendar cal)
           
static boolean isAfterToday(Date date)
           
static boolean isBeforeToday(Date date)
           
static boolean isSameDay(long time1, long time2)
           
static boolean isSameWeek(long time1, long time2)
           
static boolean isToday(Date date)
           
static long roundToMinute(long time)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECOND_IN_MS

public static final int SECOND_IN_MS
See Also:
Constant Field Values

MINUTE_IN_MS

public static final int MINUTE_IN_MS
See Also:
Constant Field Values

HALF_MINUTE_IN_MS

public static final int HALF_MINUTE_IN_MS
See Also:
Constant Field Values

HOUR_IN_MS

public static final int HOUR_IN_MS
See Also:
Constant Field Values

DAY_IN_MS

public static final int DAY_IN_MS
See Also:
Constant Field Values

DAY_IN_MINS

public static final int DAY_IN_MINS
See Also:
Constant Field Values

LOCAL_UTC_OFFSET

public static final long LOCAL_UTC_OFFSET

LOCAL_UTC_OFFSET_IN_MINUTES

public static final long LOCAL_UTC_OFFSET_IN_MINUTES
Constructor Detail

TimeSupport

public TimeSupport()
Method Detail

getUtcOffset

public static long getUtcOffset(Calendar cal)
Returns:
offset from UTC in milliseconds

isToday

public static boolean isToday(Date date)
Parameters:
date -
Returns:
true if the given date happens to be today

isBeforeToday

public static boolean isBeforeToday(Date date)
Parameters:
date -
Returns:
true if the given date is on a day earlier than today

isAfterToday

public static boolean isAfterToday(Date date)
Parameters:
date -
Returns:
true if the given date is on a day later than today

isSameDay

public static boolean isSameDay(long time1,
                                long time2)
Parameters:
time1 - time in millis
time2 - time in millis
Returns:
true if the two specified times are part of the same day

isSameWeek

public static boolean isSameWeek(long time1,
                                 long time2)
Parameters:
time1 - time in millis
time2 - time in millis
Returns:
true if the two specified times are part of the same week

roundToMinute

public static long roundToMinute(long time)
Parameters:
time - time in millis
Returns:
time in milles rounded to the minute

getMinutesSinceMidnight

public static int getMinutesSinceMidnight()
Returns:
The number of minutes passed since 00:00 hours

getMinutesSinceMidnight

public static int getMinutesSinceMidnight(long time)
Parameters:
time -
Returns:
the number of minutes passed since 00:00 hours in current time zone


Copyright © 2012. All Rights Reserved.