public class DateTimeValue extends Object implements Comparable<DateTimeValue>, DateValueContainer
| Constructor and Description |
|---|
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(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.
|
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. |
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 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 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.Copyright © 2015 AssertJ. All Rights Reserved.