jBPM Console NG - Human Tasks Client 6.0.0.CR4-Pre1

org.jbpm.console.ng.ht.client.util
Class DateUtils

java.lang.Object
  extended by org.jbpm.console.ng.ht.client.util.DateUtils

public class DateUtils
extends Object

Provides utility methods for manipulating with Dates.


Constructor Summary
DateUtils()
           
 
Method Summary
static boolean areDatesEqual(Date firstDate, Date secondDate)
          Determines if two dates are equal based only on day, month and year.
static int compareDates(Date firstDate, Date secondDate)
          Compares two dates based only on day, month and year.
static Date createDate(String dateString)
          Creates new Date object using default format - "yyyy-MM-dd" (e.g. 2013-04-25).
static Date createDate(String dateString, String dateFormat)
          Creates new Date object from specified date string and date format.
static DateRange getMonthDateRange(Date date)
          Returns a DateRange starting on first day of month in which the specified date is and ending on last day of that month.
static Date getSameOrClosestDateInNextMonth(Date date)
           
static Date getSameOrClosestDateInPreviousMonth(Date date)
           
static DateRange getWeekDateRange(Date date)
           
static DateRange getWorkWeekDateRange(Date date)
          Returns a DateRange starting on first working day of week in which the specified date is and ending on last working day (Friday) of that week.
static boolean isDateInRange(Date date, DateRange dateRange)
          Determines if the specified date is within the specified range.
 
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

createDate

public static Date createDate(String dateString)
Creates new Date object using default format - "yyyy-MM-dd" (e.g. 2013-04-25).

Parameters:
dateString - string representation of date
Returns:
new Date create from string representation

createDate

public static Date createDate(String dateString,
                              String dateFormat)
Creates new Date object from specified date string and date format.

Parameters:
dateString - string representation
dateFormat - format of the date
Returns:
new Date create from string representation

getWorkWeekDateRange

public static DateRange getWorkWeekDateRange(Date date)
Returns a DateRange starting on first working day of week in which the specified date is and ending on last working day (Friday) of that week. Total of 5 days are returned.

Parameters:
date - date from which to get the week date range
Returns:
DateRange representing the week in which the specified date is

getWeekDateRange

public static DateRange getWeekDateRange(Date date)

getMonthDateRange

public static DateRange getMonthDateRange(Date date)
Returns a DateRange starting on first day of month in which the specified date is and ending on last day of that month.

Parameters:
date - date from which to get the month date range
Returns:
DateRange representing the month in which the specified date is

isDateInRange

public static boolean isDateInRange(Date date,
                                    DateRange dateRange)
Determines if the specified date is within the specified range. Including both start and end date.

Parameters:
date - the date to test
dateRange - date range to be tested with
Returns:
true if the date is within the range, otherwise false

compareDates

public static int compareDates(Date firstDate,
                               Date secondDate)
Compares two dates based only on day, month and year. Time information is not considered.

Parameters:
firstDate - first date
secondDate - second date
Returns:
-1 if first date if before the second, 0 if the dates are equal, otherwise 1 (first is after the second)

areDatesEqual

public static boolean areDatesEqual(Date firstDate,
                                    Date secondDate)
Determines if two dates are equal based only on day, month and year. Time information is not considered.

Parameters:
firstDate - first date
secondDate - second date
Returns:
true if the dates have identical year, month and day

getSameOrClosestDateInPreviousMonth

public static Date getSameOrClosestDateInPreviousMonth(Date date)

getSameOrClosestDateInNextMonth

public static Date getSameOrClosestDateInNextMonth(Date date)

jBPM Console NG - Human Tasks Client 6.0.0.CR4-Pre1

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.