net.sourceforge.jaulp.random.date
Class RandomDateUtils

java.lang.Object
  extended by net.sourceforge.jaulp.random.date.RandomDateUtils

public class RandomDateUtils
extends java.lang.Object

This util class gets random dates.

Version:
1.0
Author:
Asterios Raptis

Constructor Summary
RandomDateUtils()
           
 
Method Summary
static java.util.Date createDateInPast(java.util.Date date, int addiereTage)
          Deprecated. Use instead DateUtils.substractDaysFromDate(date, int).
static java.util.Date createFutureDate(java.util.Date date, int addiereTage)
          Deprecated. Use instead DateUtils.addDaysToDate(date, int).
static java.util.Date createRandomBirthday()
          Creates a random birthday-date between 9 and 55 years.
static java.util.Date createRandomBirthday(java.util.Date from, java.util.Date till)
          Creates a random birthday-date between the two given date-objects.
static java.util.Date createRandomDate(java.util.Date from)
          Creates a random date.
static java.util.Date createRandomDatebetween(java.util.Date start, java.util.Date end)
          Creates a random Date between the range from start and end.
static java.util.Date createRandomDateBetween(java.util.Date from, int startDays, int endDays)
          Creates a random Date between the range from startDays and endDays from the given Date.
static java.lang.String createRandomDatebetween(long startDate, long endDate)
          Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the default "dd.MM.yyyy HH:mm:ss" format.
static java.lang.String createRandomDatebetween(long startDate, long endDate, java.lang.String format)
          Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the given format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomDateUtils

public RandomDateUtils()
Method Detail

createFutureDate

public static java.util.Date createFutureDate(java.util.Date date,
                                              int addiereTage)
Deprecated. Use instead DateUtils.addDaysToDate(date, int).

Creates a Date in the Future from the given Date.

Parameters:
date - The Date from where to compute the future date.
addiereTage - The days that have to added to the given Date.
Returns:
The date in the future.

createDateInPast

public static java.util.Date createDateInPast(java.util.Date date,
                                              int addiereTage)
Deprecated. Use instead DateUtils.substractDaysFromDate(date, int).

Creates a Date in the Past from the given Date.

Parameters:
date - The Date from where to compute the Past date.
addiereTage - The days that have to added to the given Date.
Returns:
The date in the Past.

createRandomDate

public static java.util.Date createRandomDate(java.util.Date from)
Creates a random date.

Parameters:
from - The date from where to begin.
Returns:
The random date.

createRandomDatebetween

public static java.util.Date createRandomDatebetween(java.util.Date start,
                                                     java.util.Date end)
Creates a random Date between the range from start and end.

Parameters:
start - The Date from where the range starts.
end - The Date from where the range ends.
Returns:
A random Date between the range from start and end.

createRandomDateBetween

public static java.util.Date createRandomDateBetween(java.util.Date from,
                                                     int startDays,
                                                     int endDays)
Creates a random Date between the range from startDays and endDays from the given Date.

Parameters:
from - The Date from where to the random Date to start.
startDays - The int that represents the days from where the range starts.
endDays - The int that represents the days from where the range ends.
Returns:
A random Date between the range from startDays and endDays from the given Date.

createRandomDatebetween

public static java.lang.String createRandomDatebetween(long startDate,
                                                       long endDate,
                                                       java.lang.String format)
Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the given format.

Parameters:
startDate - The date from where to start as a long.
endDate - The date from where to end as a long.
format - The format for the date.
Returns:
The random date as a String.

createRandomDatebetween

public static java.lang.String createRandomDatebetween(long startDate,
                                                       long endDate)
Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the default "dd.MM.yyyy HH:mm:ss" format.

Parameters:
startDate - The date from where to start as a long.
endDate - The date from where to end as a long.
Returns:
The random date as a String.

createRandomBirthday

public static java.util.Date createRandomBirthday()
Creates a random birthday-date between 9 and 55 years.

Returns:
's the random date.

createRandomBirthday

public static java.util.Date createRandomBirthday(java.util.Date from,
                                                  java.util.Date till)
Creates a random birthday-date between the two given date-objects.

Parameters:
from - The date from where to start.
till - The date from where to end.
Returns:
's the random date.


Copyright © 2010. All Rights Reserved.