net.sf.jzeno.util
Class DateUtils

java.lang.Object
  extended by net.sf.jzeno.util.DateUtils

public class DateUtils
extends java.lang.Object

Helper operation for date manipulation, mainly to help working with UTC dates and local dates. Makes life a little easier ;-).


Constructor Summary
DateUtils()
           
 
Method Summary
static java.util.Date addDays(java.util.Date original, int days)
           This operation is useful to add or subtract a certain number of days to or from a given original date.
static java.util.Date addHours(java.util.Date original, int hours)
           This operation adds a specified number of hours to a given date object.
static java.util.Date endOfDay(java.util.Date arbitraryTimeInDay)
           Convenience method to set the time portion of a Date object to 23:59:59.997, end of day.
static java.util.Date endOfWeek(java.util.Date arbitraryDateInWeek)
           Convenience method to calculate sunday, 23:59:59.999 of the week the supplied date belongs to.
static java.lang.String formatDate(java.util.Date date)
           Use this function for formatting a date according to the configured DateFormat implementation (in configuration.properties)
static java.lang.String formatDate(java.util.Date date, java.lang.String formatString)
           Use this function for formatting a date according to the supplied date format.
static java.lang.String formatTime(java.util.Date time)
           Use this function for formatting a time according to the configured DateFormat implementation (in configuration.properties)
static java.util.Date getCurrentUTCDate()
           This operation returns the current time in UTC.
static java.util.Date startOfDay(java.util.Date arbitraryTimeInDay)
           Convenience method to set the time portion of a Date object to 00:00:00, start of day.
static java.util.Date startOfWeek(java.util.Date arbitraryDateInWeek)
           Convenience method to calculate monday, 00:00:00.000 of the week the supplied date belongs to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtils

public DateUtils()
Method Detail

addDays

public static java.util.Date addDays(java.util.Date original,
                                     int days)

This operation is useful to add or subtract a certain number of days to or from a given original date.


addHours

public static java.util.Date addHours(java.util.Date original,
                                      int hours)

This operation adds a specified number of hours to a given date object.


startOfDay

public static java.util.Date startOfDay(java.util.Date arbitraryTimeInDay)

Convenience method to set the time portion of a Date object to 00:00:00, start of day.


endOfDay

public static java.util.Date endOfDay(java.util.Date arbitraryTimeInDay)

Convenience method to set the time portion of a Date object to 23:59:59.997, end of day.


startOfWeek

public static java.util.Date startOfWeek(java.util.Date arbitraryDateInWeek)

Convenience method to calculate monday, 00:00:00.000 of the week the supplied date belongs to.


endOfWeek

public static java.util.Date endOfWeek(java.util.Date arbitraryDateInWeek)

Convenience method to calculate sunday, 23:59:59.999 of the week the supplied date belongs to.


formatDate

public static java.lang.String formatDate(java.util.Date date)

Use this function for formatting a date according to the configured DateFormat implementation (in configuration.properties)


formatDate

public static java.lang.String formatDate(java.util.Date date,
                                          java.lang.String formatString)

Use this function for formatting a date according to the supplied date format.


formatTime

public static java.lang.String formatTime(java.util.Date time)

Use this function for formatting a time according to the configured DateFormat implementation (in configuration.properties)


getCurrentUTCDate

public static java.util.Date getCurrentUTCDate()

This operation returns the current time in UTC.