public class DateWrapper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DateWrapper.Unit
Represents the different unit values that the
add(Unit, int) method takes |
Constructor and Description |
---|
DateWrapper()
Creates a new instance with the current time.
|
DateWrapper(Date date)
Creates a new instance with the given date.
|
DateWrapper(int year,
int month,
int day)
Creates a new instance with the given values.
|
DateWrapper(long time)
Creates a new instance with the given time in milliseconds.
|
Modifier and Type | Method and Description |
---|---|
DateWrapper |
add(DateWrapper.Unit unit,
int quantity)
Provides a convenient method of performing basic date arithmetic.
|
DateWrapper |
addDays(int days)
Returns a new DateWrapper with days added
|
DateWrapper |
addHours(int hours)
Returns a new DateWrapper with hours added
|
DateWrapper |
addMillis(int millis)
Returns a new DateWrapper with millis added
|
DateWrapper |
addMinutes(int minutes)
Returns a new DateWrapper with minutes added
|
DateWrapper |
addMonths(int months)
Returns a new DateWrapper with months added
|
DateWrapper |
addSeconds(int seconds)
Returns a new DateWrapper with seconds added
|
DateWrapper |
addYears(int years)
Returns a new DateWrapper with years added
|
Date |
asDate()
Returns a new Date instance
|
boolean |
before(DateWrapper dateWrapper) |
DateWrapper |
clearTime()
Returns a new instance with the time portion
(hours/minutes/seconds/milliseconds) cleared.
|
DateWrapper |
clone() |
protected static String |
format(Date date,
String format) |
protected static String |
format(float date,
String format) |
int |
getDate()
Returns the day of the month
|
int |
getDay()
Returns the day of the week
|
int |
getDayInWeek()
Returns the day of the week
|
int |
getDayOfYear()
Returns the day of the year
|
int |
getDaysInMonth()
Returns the number of days in the month.
|
DateWrapper |
getFirstDayOfMonth()
Returns the first date of the month.
|
int |
getFullYear()
Returns the full year
|
int |
getHours()
Returns the hour
|
DateWrapper |
getLastDateOfMonth()
Returns the last date of the month.
|
long |
getMilliseconds()
Returns the milliseconds
|
int |
getMinutes()
Returns the minutes
|
int |
getMonth()
Returns the month
|
int |
getSeconds()
Returns the seconds
|
long |
getTime()
Returns the time in milliseconds.
|
DateWrapper |
resetTime()
Returns a new instance with the time portion
(hours/minutes/seconds/milliseconds) reseted to 12am.
|
String |
toString() |
public DateWrapper()
public DateWrapper(Date date)
date
- the datepublic DateWrapper(int year, int month, int day)
year
- the yearmonth
- the monthday
- the daypublic DateWrapper(long time)
time
- the time in millisecondspublic DateWrapper add(DateWrapper.Unit unit, int quantity)
unit
- the DateWrapper.Unit
quantity
- the quantity to addaddMillis(int)
,
addSeconds(int)
,
addMinutes(int)
,
addHours(int)
,
addDays(int)
,
addMonths(int)
,
addYears(int)
public DateWrapper addDays(int days)
add(DateWrapper.Unit, int)
public DateWrapper addHours(int hours)
add(DateWrapper.Unit, int)
public DateWrapper addMillis(int millis)
add(DateWrapper.Unit, int)
public DateWrapper addMinutes(int minutes)
add(DateWrapper.Unit, int)
public DateWrapper addMonths(int months)
add(DateWrapper.Unit, int)
public DateWrapper addSeconds(int seconds)
add(DateWrapper.Unit, int)
public DateWrapper addYears(int years)
add(DateWrapper.Unit, int)
public Date asDate()
public boolean before(DateWrapper dateWrapper)
public DateWrapper clearTime()
public DateWrapper clone()
public int getDate()
public int getDay()
public int getDayInWeek()
public int getDayOfYear()
public int getDaysInMonth()
public DateWrapper getFirstDayOfMonth()
public int getFullYear()
public int getHours()
public DateWrapper getLastDateOfMonth()
public long getMilliseconds()
public int getMinutes()
public int getMonth()
public int getSeconds()
public long getTime()
public DateWrapper resetTime()
Copyright © 2018. All rights reserved.