|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.util.DateUtil
public class DateUtil
Utility class for date manipulation. This class gives a simple interface for common Date, Calendar and Timezone operations. It is possible to apply subsequent transformations to an initial date, and retrieve the changed Date object at any point.
Constructor Summary | |
---|---|
DateUtil()
Inizialize a new instance with the current date |
|
DateUtil(java.util.Date d)
Inizialize a new instance with the given date |
Method Summary | |
---|---|
DateUtil |
addMinutes(int minutes)
Make the date go forward of the specified amount of minutes The internal date is changed after this call. |
static java.lang.String |
formatDate(java.util.Calendar date)
Format a date to standard format. |
static java.lang.String |
formatDateTimeUTC(java.util.Calendar datetime)
Format a date-time into UTC format. |
static java.lang.String |
formatDateTimeUTC(java.util.Date date)
Format a date-time into UTC format. |
static java.lang.String |
formatDateTimeUTC(long date)
Format a date-time into UTC format. |
int |
getDaysSince(java.util.Date date)
Get the days passed from the specified date up to the date provided in the constructor |
static java.util.Calendar |
getSafeTimeForAllDay(java.util.Calendar cal)
Get a safe time for all day given a certain calendar. |
java.util.Date |
getTime()
Get the current time |
java.lang.String |
getTZ()
Get the current TimeZone |
boolean |
isAfter(java.util.Date date)
Utility method wrapping Calendar.after method Compares the date field parameter with the date provided with the constructor answering the question: date from constructor is after the given param date ? |
static java.util.Calendar |
parseDate(java.lang.String field)
Deprecated. use parseDateTime instead |
static java.util.Calendar |
parseDateTime(java.lang.String field)
Parse date and time from a string. |
DateUtil |
removeDays(int days)
Make the date go back of the specified amount of days The internal date is changed after this call. |
void |
setTime(java.util.Date d)
Set a new time |
DateUtil |
toGMT()
Convert the date to GMT. |
DateUtil |
toMidnight()
Convert the time to the midnight of the currently set date. |
DateUtil |
toTZ(java.lang.String tz)
Convert the date to the given timezone. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateUtil()
public DateUtil(java.util.Date d)
Method Detail |
---|
public void setTime(java.util.Date d)
public java.util.Date getTime()
public java.lang.String getTZ()
public DateUtil toMidnight()
public DateUtil removeDays(int days)
public DateUtil addMinutes(int minutes)
public DateUtil toGMT()
public DateUtil toTZ(java.lang.String tz)
tz
- The name of the timezone to set
public int getDaysSince(java.util.Date date)
date
- The starting date
public boolean isAfter(java.util.Date date)
date
- The date to be used for comparison
public static java.lang.String formatDateTimeUTC(java.util.Calendar datetime)
datetime
- is the date-time to be formatted
public static java.lang.String formatDate(java.util.Calendar date)
date
- is the date to be formatted
public static java.lang.String formatDateTimeUTC(java.util.Date date)
date
- is the date to be formatted. This value will be interpreted
as relative to the default timezone
public static java.lang.String formatDateTimeUTC(long date)
date
- is the date to be formatted. This value will be interpreted
as relative to the default timezone
public static java.util.Calendar parseDate(java.lang.String field)
field
- date time in one of the supported formats
java.lang.IllegalArgumentException
- if the input date is not valid
(according to the acceptable formats)public static java.util.Calendar parseDateTime(java.lang.String field)
field
- date time in one of the supported formats
java.lang.IllegalArgumentException
- if the input date is not valid
(according to the acceptable formats)public static java.util.Calendar getSafeTimeForAllDay(java.util.Calendar cal)
cal
- a calendar
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |