public final class DateTime extends Object implements IIvyDataObject, Comparable<DateTime>
Modifier and Type | Field and Description |
---|---|
static DateTime |
INVALID
An invalid datetime object.
|
static DateTime |
UNINITIALIZED_DATE_TIME
An uninitialized date object
|
Constructor and Description |
---|
DateTime()
Creates a new DateTime object
representing the actual day.
|
DateTime(Date date,
Time time)
Creates a new DateTime object from a date and a day-time.
|
DateTime(int _year,
int _month,
int _day,
int _hours,
int _minutes,
int _seconds)
Creates a new date object.
|
DateTime(String literal)
Parses a DateTime literal and creates a new corresponding Date object.
|
Modifier and Type | Method and Description |
---|---|
DateTime |
add(Duration duration)
Adds a duration to this date.
|
DateTime |
clone()
Creates a clone of this object.
|
int |
compareTo(DateTime otherDateTime)
Compares two DataTime objects.
|
boolean |
equals(Object anotherDate)
Test two objects for euality.
|
String |
format()
Formats this
DateTime with the default format.The default format is defined in the configuration under Formats > DateTime > default . |
String |
format(String formatName)
Formats this
DateTime with the given format config. |
String |
format(String dateFormatName,
String timeFormatName)
Formats this
DateTime with the given format configurations for the date and time part. |
Date |
getDate()
|
int |
getDay()
Returns the day of this DateTime object.
|
int |
getDayOfWeek()
Returns the day of the week for this DateTime object.
|
Duration |
getDurationFromNow()
Calculates the duration from the current dateTime to actual dateTime instance.
|
int |
getHours()
Returns the hours for this DateTime object.
|
int |
getMinutes()
Returns the minutes for this DateTime object.
|
int |
getMonth()
Returns the month of this DateTime object.
|
int |
getSeconds()
Returns the seconds for this DateTime object.
|
Time |
getTime()
|
int |
getYear()
Returns the year of this DateTime object.
|
int |
hashCode()
A hashcode; the number of seconds after 1970-01-01.
|
Duration |
minus(DateTime dateTime)
Returns a normalized Duration representing the difference between this
DateTime and the argument.
|
DateTime |
minus(Duration duration)
Subtracts a duration to this date.
|
Date |
toIvyDate()
|
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 hh:mm:ss).
|
Time |
toTime()
|
deepClone
public static final DateTime UNINITIALIZED_DATE_TIME
public static final DateTime INVALID
public DateTime()
public DateTime(int _year, int _month, int _day, int _hours, int _minutes, int _seconds)
_year
- The year of the DateTime object._month
- The month of the DateTime object. 1=January, 2=February .. 11=November, 12=December_day
- The day of the DateTime object. 1..28, 29, 30, 31 depending on month_hours
- The hours of the DateTime object._minutes
- The minutes of the DateTime object._seconds
- The seconds of the DateTime object.public DateTime(Date date, Time time)
date
- time
- public DateTime(String literal)
If the format of the argument is not correct, an IllegalArgumentException
will be thrown.
literal
- A date literal in the format
IllegalArgumentException
- if the argument has an illegal format.public Date getDate()
public Time getTime()
public int getYear()
public int getMonth()
public int getDay()
public int getDayOfWeek()
public int getHours()
public int getMinutes()
public int getSeconds()
public DateTime add(Duration duration)
duration
- A duration.public DateTime minus(Duration duration)
duration
- A duration.public Duration minus(DateTime dateTime)
dateTime
- public Duration getDurationFromNow()
public long toNumber()
public int compareTo(DateTime otherDateTime)
otherDateTime
- Some date.public String toString()
public Date toIvyDate()
public Time toTime()
public String format()
DateTime
with the default format.Formats > DateTime > default
.public String format(String formatName)
DateTime
with the given format config.formatName
- Name of a configuration under Formats > DateTime
. public String format(String dateFormatName, String timeFormatName)
DateTime
with the given format configurations for the date and time part.dateFormatName
- Name of a configuration under Formats > Date
. timeFormatName
- Name of a configuration under Formats > Time
. public boolean equals(Object anotherDate)
public int hashCode()
public DateTime clone()
clone
in interface IIvyDataObject
clone
in class Object
Copyright © 2024
AXON IVY AG
All Rights Reserved Documentation was generated
on April 28, 2024