com.pow2.util
Class DateUtil

java.lang.Object
  extended bycom.pow2.util.DateUtil

public class DateUtil
extends Object

Date utility class.

Author:
Luca Fossato

Constructor Summary
DateUtil()
           
 
Method Summary
static Date addDays(Date startDate, int days)
          Add the input number of days to the start Date object.
static Date addDays(String startDate, String dateFormat, int days)
          Add the input number of days to the startDate string representation.
static String getCurrentDateString(String dateFormat)
          Get the current date string representation.
static Date getDate(String sDate, String dateFormat)
          Get a java Date object from an input date string representation.
static String getDateString(Date date, String dateFormat)
          Get the string representation of the input Date object
static boolean isDateBetween(Date d, Date d1, Date d2)
          Check if the d input date is between d1 and d2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtil

public DateUtil()
Method Detail

getCurrentDateString

public static String getCurrentDateString(String dateFormat)
Get the current date string representation.

Parameters:
dateFormat - the input dateFormat. See the java.text.SimpleDateFormat API for date format string examples

getDateString

public static String getDateString(Date date,
                                   String dateFormat)
Get the string representation of the input Date object

Parameters:
date - the input Date object
dateFormat - a date format string like "dd/MM/yyyy"
Returns:
the string representation of the input Date object

getDate

public static Date getDate(String sDate,
                           String dateFormat)
Get a java Date object from an input date string representation.
See the java.text.SimpleDateFormat API for date format string examples.

Parameters:
sDate - the date string representation
dateFormat - a date format string like "dd/MM/yyyy"
Returns:
the Date object corresponding to the input date string, or null if the conversion fails

addDays

public static Date addDays(String startDate,
                           String dateFormat,
                           int days)
Add the input number of days to the startDate string representation.

Parameters:
startDate - the start date string representation
dateFormat - the start date format
days - the number of days to add to the startDate
Returns:
the Date object representing the resulting date

addDays

public static Date addDays(Date startDate,
                           int days)
Add the input number of days to the start Date object.

Parameters:
startDate - the start Date object
days - the number of days to add to the startDate object
Returns:
the Date object representing the resulting date

isDateBetween

public static boolean isDateBetween(Date d,
                                    Date d1,
                                    Date d2)
Check if the d input date is between d1 and d2.

Parameters:
d - the date to check
d1 - the lower boundary date
d2 - the upper boundary date
Returns:
true if d1 <= d <= d2, false otherwise


Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.