edu.rice.rubis.servlets
Class TimeManagement
java.lang.Object
|
+--edu.rice.rubis.servlets.TimeManagement
- public class TimeManagement
- extends java.lang.Object
This class provides additionnal functions that the GregorianCalendar
class does not provide. It is mainly to compute time differences and
display the date in a database understandable format.
Method Summary |
static java.util.GregorianCalendar |
addDays(java.util.GregorianCalendar startDate,
int durationInDays)
Compute a new GregorianCalendar from a beginning date and a duration in days. |
static java.lang.String |
currentDateToString()
Returns a string representation of the current date (when the method is called)
conforming to the following database format : 'YYYY-MM-DD hh:mm:ss' |
static java.lang.String |
dateToString(java.util.GregorianCalendar d)
Returns a string representation of a date conforming to
the following database format : 'YYYY-MM-DD hh:mm:ss' |
static java.lang.String |
diffTime(java.util.GregorianCalendar startDate,
java.util.GregorianCalendar endDate)
Returns a string representation of the time elapsed between startDate
and endDate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimeManagement
public TimeManagement()
currentDateToString
public static java.lang.String currentDateToString()
- Returns a string representation of the current date (when the method is called)
conforming to the following database format : 'YYYY-MM-DD hh:mm:ss'
- Returns:
- current date in database format
dateToString
public static java.lang.String dateToString(java.util.GregorianCalendar d)
- Returns a string representation of a date conforming to
the following database format : 'YYYY-MM-DD hh:mm:ss'
- Returns:
- current date in database format
diffTime
public static java.lang.String diffTime(java.util.GregorianCalendar startDate,
java.util.GregorianCalendar endDate)
- Returns a string representation of the time elapsed between startDate
and endDate. Example of a returned string : "1 month 3 days 6 hours 33 minutes 4 seconds 234 milliseconds"
- Parameters:
startDate
- beginning dateendDate
- ending date- Returns:
- string containing the time difference up to the millisecond
addDays
public static java.util.GregorianCalendar addDays(java.util.GregorianCalendar startDate,
int durationInDays)
- Compute a new GregorianCalendar from a beginning date and a duration in days.
- Parameters:
startDate
- beginning datedurationInDays
- number of days to add to startDate.- Returns:
- date corresponding to startDate+durationInDays
Copyright © 2003 - ObjectWeb Consortium - All Rights Reserved.