public class Age extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
static long |
ONE_DAY
The Constant ONE_DAY.
|
static long |
ONE_DEFAULT_MONTH
The Constant ONE_DEFAULT_MONTH.
|
static long |
ONE_HOUR
The Constant ONE_HOUR.
|
static long |
ONE_MINUTE
The Constant ONE_MINUTE.
|
static long |
ONE_SECOND
The Constant ONE_SECOND.
|
static long |
ONE_YEAR
The Constant ONE_YEAR.
|
| Constructor and Description |
|---|
Age(Date birthday)
|
Age(Date birthday,
Date till)
|
Age(long elapsed)
|
| Modifier and Type | Method and Description |
|---|---|
double |
calculateInDays()
Calculate in days.
|
double |
calculateInDays(long time)
Calculate in days.
|
double |
calculateInDefaultMonth()
Calculate in default month.
|
double |
calculateInDefaultMonth(long time)
Calculate in default month.
|
double |
calculateInHours()
Calculate in hours.
|
double |
calculateInHours(long time)
Calculate in hours.
|
double |
calculateInMinutes()
Calculate in minutes.
|
double |
calculateInMinutes(long time)
Calculate in minutes.
|
double |
calculateInSeconds()
Calculate in seconds.
|
double |
calculateInSeconds(long time)
Calculate in minutes.
|
double |
calculateInYears()
Calculate in years.
|
double |
calculateInYears(long el)
Calculate in years.
|
int[] |
calculateInYearsMonthsDaysHoursMinutesAndSeconds()
Calculate in years months days hours minutes and seconds.
|
int[] |
calculateInYearsMonthsDaysHoursMinutesAndSeconds(long compute)
Calculate in years months days hours minutes and seconds.
|
String |
getHumanReadableAge()
Gets a human readable string from the age.
|
String |
getHumanReadableAge(int[] readableAge)
Gets a human readable string from the age.
|
static Age |
of(Date birthday)
Factory method to create a new
Age object from the given birthday Date object. |
static Age |
of(Date birthday,
Date till)
|
static Age |
of(long startFrom)
Factory method to create a new
Age object from the given birthday Date object. |
public static final long ONE_SECOND
public static final long ONE_MINUTE
public static final long ONE_HOUR
public static final long ONE_DAY
public static final long ONE_DEFAULT_MONTH
public static final long ONE_YEAR
public Age(Date birthday)
Age object from the given birthday Date object. It
calculates the age from the given birthday Date object till now.birthday - The birthday.public Age(Date birthday, Date till)
Age object from the given birthday Date object and the
given till Date object. It calculates the age from the given birthday Date object
till the given till Date object.birthday - The birthday.till - The point where the Age stops.public static Age of(Date birthday)
Age object from the given birthday Date object. It
calculates the age from the given birthday Date object till now.birthday - the birthdayAge objectpublic static Age of(Date birthday, Date till)
Age object from the given birthday Date object
and the given till Date object. It calculates the age from the given birthday Date
object till the given till Date object.birthday - the birthdaytill - The point where the Age stops.Age objectpublic static Age of(long startFrom)
Age object from the given birthday Date object. It
calculates the age from the given birthday Date object till now.public double calculateInDays()
public double calculateInDays(long time)
time - the timepublic double calculateInDefaultMonth()
public double calculateInDefaultMonth(long time)
time - the time.public double calculateInHours()
public double calculateInHours(long time)
time - the timepublic double calculateInMinutes()
public double calculateInMinutes(long time)
time - the timepublic double calculateInSeconds()
public double calculateInSeconds(long time)
time - the timepublic double calculateInYears()
public double calculateInYears(long el)
el - The time.public int[] calculateInYearsMonthsDaysHoursMinutesAndSeconds()
public int[] calculateInYearsMonthsDaysHoursMinutesAndSeconds(long compute)
compute - The long to calculate.public String getHumanReadableAge()
public String getHumanReadableAge(int[] readableAge)
readableAge - The int array with the age values.Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.