public class DateValue extends Object implements Comparable<DateValue>, DateValueContainer
| Constructor and Description |
|---|
DateValue(Calendar calendar)
Constructor.
|
DateValue(Date date)
Constructor.
|
DateValue(int year,
int month,
int dayOfTheMonth)
Constructor.
|
DateValue(String date)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(DateValue other) |
boolean |
equals(Object obj) |
static DateValue |
from(Calendar calendar)
Makes an instance of date value from a
Calendar. |
static DateValue |
from(Date date)
Makes an instance of date value from a
Date. |
DateValue |
getDate()
Returns the date.
|
int |
getDayOfTheMonth()
Returns the day of the month.
|
int |
getMonth()
Returns the month.
|
int |
getYear()
Returns the year.
|
int |
hashCode() |
boolean |
isAfter(DateValue date)
Returns if this date value is after the date value in parameter.
|
boolean |
isBefore(DateValue date)
Returns if this date value is before the date value in parameter.
|
boolean |
isMidnight()
Returns if it is midnight.
|
DateTimeValue |
move(DateTimeValue dateTime)
Moves the date with the value in parameter.
|
DateValue |
move(DateValue date)
Moves the date with the value in parameter.
|
DateTimeValue |
move(TimeValue time)
Moves the date with the value in parameter.
|
static DateValue |
now()
Makes an instance of the date value corresponding to now.
|
static DateValue |
of(int year,
int month,
int dayOfTheMonth)
Makes an instance of date value from a day of month, a month and an year.
|
static DateValue |
parse(String date)
Makes an instance of date value from a
String in format yyyy-mm-dd. |
DateValue |
reverse()
Returns the reverse of the date.
|
String |
toString() |
public DateValue(int year,
int month,
int dayOfTheMonth)
year - Year.month - Month.dayOfTheMonth - Day of the month.public DateValue(String date) throws ParseException
date - Date in String format (yyyy-mm-dd).NullPointerException - If date is null.ParseException - If date don't respect the yyyy-mm-dd format.public DateValue(Date date)
date - Date.NullPointerException - If date is null.public DateValue(Calendar calendar)
calendar - Calendar.NullPointerException - If calendar is null.public static DateValue of(int year, int month, int dayOfTheMonth)
year - Year.month - Month.dayOfTheMonth - Day of the month.public static DateValue parse(String date) throws ParseException
String in format yyyy-mm-dd.date - Date in String format (yyyy-mm-dd).NullPointerException - If date is null.ParseException - If date don't respect the yyyy-mm-dd format.public static DateValue from(Date date)
Date.date - Date.NullPointerException - If date is null.public static DateValue from(Calendar calendar)
Calendar.calendar - Calendar.NullPointerException - If calendar is null.public static DateValue now()
public DateValue getDate()
getDate in interface DateValueContainerpublic boolean isMidnight()
DateValueContainerisMidnight in interface DateValueContainertrue if it is midnight.public int getDayOfTheMonth()
public int getMonth()
public int getYear()
public int compareTo(DateValue other)
compareTo in interface Comparable<DateValue>public boolean isBefore(DateValue date)
date - The date value to compare to.public boolean isAfter(DateValue date)
date - The date value to compare to.public DateValue move(DateValue date)
date - Value to move the date.public DateTimeValue move(TimeValue time)
time - Value to move the date.public DateTimeValue move(DateTimeValue dateTime)
dateTime - Value to move the date.public DateValue reverse()
Copyright © 2015–2017 AssertJ. All rights reserved.