public class DateTimeValue extends Object implements Comparable<DateTimeValue>, DateValueContainer
| Constructor and Description |
|---|
DateTimeValue(Calendar calendar)
Constructor.
|
DateTimeValue(DateValue date,
TimeValue time)
Constructor.
|
DateTimeValue(String dateTime)
Constructor.
|
DateTimeValue(Timestamp timestamp)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(DateTimeValue other) |
boolean |
equals(Object obj) |
static DateTimeValue |
from(Calendar calendar)
Makes an instance of date/time value from a
Calendar. |
static DateTimeValue |
from(Timestamp timestamp)
Makes an instance of date/time value from a
Timestamp. |
DateValue |
getDate()
Returns the date.
|
TimeValue |
getTime()
Returns the time.
|
int |
hashCode() |
boolean |
isAfter(DateTimeValue dateTime)
Returns if this date/time value is after the date/time value in parameter.
|
boolean |
isBefore(DateTimeValue dateTime)
Returns if this date/time value is before the date/time value in parameter.
|
boolean |
isMidnight()
Returns if it is midnight.
|
DateTimeValue |
move(DateTimeValue dateTime)
Moves the date/time with the value in parameter.
|
DateTimeValue |
move(DateValue date)
Moves the date/time with the value in parameter.
|
DateTimeValue |
move(TimeValue time)
Moves the date/time with the value in parameter.
|
static DateTimeValue |
now()
Makes an instance of the date/time value corresponding to now.
|
static DateTimeValue |
of(DateValue date)
Makes an instance of date/time value from a date with time at 00:00AM.
|
static DateTimeValue |
of(DateValue date,
TimeValue time)
Makes an instance of date/time value from a date and a time.
|
static DateTimeValue |
parse(String dateTime)
Makes an instance of date/time value from a
String in yyyy-mm-dd, yyyy-mm-ddThh:mm,
yyyy-mm-ddThh:mm:ss or yyyy-mm-ddThh:mm:ss.nnnnnnnnn format. |
DateTimeValue |
reverse()
Returns the reverse of the date/time.
|
String |
toString() |
public DateTimeValue(DateValue date, TimeValue time)
date - The date.time - The time.NullPointerException - If date or time is null.public DateTimeValue(String dateTime) throws ParseException
dateTime - Time in String format (yyyy-mm-dd, yyyy-mm-ddThh:mm,
yyyy-mm-ddThh:mm:ss or yyyy-mm-ddThh:mm:ss.nnnnnnnnn).NullPointerException - If dateTime is null.ParseException - If date don't respect the yyyy-mm-dd, yyyy-mm-ddThh:mm,
yyyy-mm-ddThh:mm:ss or yyyy-mm-ddThh:mm:ss.nnnnnnnnn format.public DateTimeValue(Timestamp timestamp)
timestamp - Timestamp.NullPointerException - If dateTime is null.public DateTimeValue(Calendar calendar)
calendar - Calendar.NullPointerException - If calendar is null.public static DateTimeValue of(DateValue date)
date - The date.public static DateTimeValue of(DateValue date, TimeValue time)
date - The date.time - The time.public static DateTimeValue parse(String dateTime) throws ParseException
String in yyyy-mm-dd, yyyy-mm-ddThh:mm,
yyyy-mm-ddThh:mm:ss or yyyy-mm-ddThh:mm:ss.nnnnnnnnn format.dateTime - Date/time in String format (yyyy-mm-dd).NullPointerException - If dateTime is null.ParseException - If date don't respect the yyyy-mm-dd, yyyy-mm-ddThh:mm,
yyyy-mm-ddThh:mm:ss or yyyy-mm-ddThh:mm:ss.nnnnnnnnn format.public static DateTimeValue from(Timestamp timestamp)
Timestamp.timestamp - Timestamp.NullPointerException - If timestamp is null.public static DateTimeValue from(Calendar calendar)
Calendar.calendar - Calendar.NullPointerException - If calendar is null.public static DateTimeValue now()
public DateValue getDate()
getDate in interface DateValueContainerpublic boolean isMidnight()
DateValueContainerisMidnight in interface DateValueContainertrue if it is midnight.public TimeValue getTime()
public int compareTo(DateTimeValue other)
compareTo in interface Comparable<DateTimeValue>public boolean isBefore(DateTimeValue dateTime)
dateTime - The date/time value to compare to.public boolean isAfter(DateTimeValue dateTime)
dateTime - The date/time value to compare to.public DateTimeValue 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 DateTimeValue reverse()
Copyright © 2015–2017 AssertJ. All rights reserved.