|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.ntnu.vegare.visualizer.client.utils.TimeUtils
public class TimeUtils
Provides access to commonly used date and time utility functions. All methods are static and universally available, and should not depend on any state.
Field Summary | |
---|---|
static int |
DAY
|
static int |
HOUR
|
static int |
MINUTE
|
static int |
WEEK
|
static int |
YEAR
|
Constructor Summary | |
---|---|
TimeUtils()
|
Method Summary | |
---|---|
static int |
dateToTimestamp(java.util.Date value)
Convert a Date object to a UNIX timestamp |
static java.util.Date |
getCurrentDate()
|
static java.util.Date |
getCurrentPlus(int seconds)
Returns the current time, plus/minus a given number of seconds. |
static int |
getCurrentTime()
|
static int |
round(int timestamp,
int closest)
Round a UNIX timestamp to the closest interval. |
static java.lang.String |
timestampToDate(java.lang.Integer value)
Convert a UNIX timestamp to a Date object |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MINUTE
public static final int HOUR
public static final int DAY
public static final int WEEK
public static final int YEAR
Constructor Detail |
---|
public TimeUtils()
Method Detail |
---|
public static int getCurrentTime()
public static java.util.Date getCurrentDate()
public static java.util.Date getCurrentPlus(int seconds)
seconds
- Difference from current time in seconds
public static int dateToTimestamp(java.util.Date value)
value
- Date object
public static java.lang.String timestampToDate(java.lang.Integer value)
value
- UNIX timestamp
public static int round(int timestamp, int closest)
timestamp
- UNIX timestampclosest
- Size of interval
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |