public final class Date extends Object implements IIvyDataObject, Comparable<Date>
Modifier and Type | Field and Description |
---|---|
static Date |
INVALID
An invalid date object.
|
static Date |
UNINITIALIZED_DATE
An uninitialized date object.
|
Constructor and Description |
---|
Date()
Creates a new Date object representing the actual day.
|
Date(int _year,
int _month,
int _day)
Creates a new date object.
|
Date(String literal)
Parses a Date literal and creates a new corresponding Date object.
|
Modifier and Type | Method and Description |
---|---|
Date |
add(Duration duration)
Adds a duration to this date.
|
Date |
clone()
Creates a clone of this object.
|
int |
compareTo(Date otherDate)
Compares two dates.
|
boolean |
equals(Object anotherDate)
Test two objects for equality.
|
String |
format()
Formats this
Date with the default format.The default format is defined in the configuration under Formats > Date > default . |
String |
format(String formatName)
Formats this
Date with the given format config. |
int |
getDay()
Returns the day of the date.
|
int |
getDayOfWeek()
Returns the day of the week for this date.
|
Duration |
getDurationFromNow()
Calculates the duration from the current date to actual date instance.
|
int |
getMonth()
Returns the month of the date.
|
int |
getYear()
Returns the year of the date.
|
int |
hashCode()
A hash code.
|
Duration |
minus(Date date)
Returns a normalized Duration representing the difference between this Date
and the argument.
|
Date |
minus(Duration duration)
Subtracts a duration to this date.
|
long |
toNumber()
Converts this date to a number; this is the number of second of this date
after 1970-01-01 00:00:00.
|
String |
toString()
Returns the date as String in the ISO-8601 format (yyyy-mm-dd).
|
deepClone
public static final Date UNINITIALIZED_DATE
public static final Date INVALID
public Date()
public Date(int _year, int _month, int _day)
_year
- The year of the date._month
- The month of the date. 1=January, 2=February, .. 11=November, 12=December_day
- The day of the date. 1..28, 29, 30, 31 depending on monthpublic Date(String literal)
literal
- A date literal in the format yyyy-mm-dd or dd.mm.yyyy.IllegalArgumentException
- if the argument has an illegal format.public int getYear()
public int getMonth()
public int getDay()
public int getDayOfWeek()
public Date add(Duration duration)
duration
- A duration.public Date minus(Duration duration)
duration
- A duration.public Duration minus(Date date)
date
- public Duration getDurationFromNow()
public long toNumber()
public int compareTo(Date otherDate)
otherDate
- Some date.public String toString()
public String format()
Date
with the default format.Formats > Date > default
.public String format(String formatName)
Date
with the given format config.formatName
- Name of a configuration under Formats > Date
. public boolean equals(Object anotherDate)
public int hashCode()
public Date clone()
clone
in interface IIvyDataObject
clone
in class Object
Copyright © 2024
AXON IVY AG
All Rights Reserved Documentation was generated
on April 28, 2024