Java org.apache.commons.lang3.time DateUtils fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.lang3.time DateUtils fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.lang3.time DateUtils.

The text is from its open source code.

Subclass

org.apache.commons.lang3.time.DateUtils has subclasses.
Click this link to see all its subclasses.

Field

longMILLIS_PER_SECOND
Number of milliseconds in a standard second.
longMILLIS_PER_MINUTE
Number of milliseconds in a standard minute.
longMILLIS_PER_HOUR
Number of milliseconds in a standard hour.
longMILLIS_PER_DAY
Number of milliseconds in a standard day.

Constructor

DateUtils()

DateUtils instances should NOT be constructed in standard programming.

Method

DateaddDays(final Date date, final int amount)
Adds a number of days to a date returning a new object.
DateaddHours(final Date date, final int amount)
Adds a number of hours to a date returning a new object.
DateaddMilliseconds(final Date date, final int amount)
Adds a number of milliseconds to a date returning a new object.
DateaddMinutes(final Date date, final int amount)
Adds a number of minutes to a date returning a new object.
DateaddMonths(final Date date, final int amount)
Adds a number of months to a date returning a new object.
DateaddSeconds(final Date date, final int amount)
Adds a number of seconds to a date returning a new object.
DateaddWeeks(final Date date, final int amount)
Adds a number of weeks to a date returning a new object.
DateaddYears(final Date date, final int amount)
Adds a number of years to a date returning a new object.
Dateceiling(final Date date, final int field)

Gets a date ceiling, leaving the field specified as the most significant field.

For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 14:00:00.000.

Calendarceiling(final Calendar date, final int field)

Gets a date ceiling, leaving the field specified as the most significant field.

For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 14:00:00.000.

Dateceiling(final Object date, final int field)

Gets a date ceiling, leaving the field specified as the most significant field.

For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 14:00:00.000.

longgetFragmentInDays(final Date date, final int fragment)

Returns the number of days within the fragment.

longgetFragmentInDays(final Calendar calendar, final int fragment)

Returns the number of days within the fragment.

longgetFragmentInHours(final Date date, final int fragment)

Returns the number of hours within the fragment.

longgetFragmentInHours(final Calendar calendar, final int fragment)

Returns the number of hours within the fragment.

longgetFragmentInMilliseconds(final Date date, final int fragment)

Returns the number of milliseconds within the fragment.

longgetFragmentInMilliseconds(final Calendar calendar, final int fragment)

Returns the number of milliseconds within the fragment.

booleanisSameDay(final Date date1, final Date date2)

Checks if two date objects are on the same day ignoring time.

28 Mar 2002 13:45 and 28 Mar 2002 06:01 would return true.

booleanisSameDay(final Calendar cal1, final Calendar cal2)

Checks if two calendar objects are on the same day ignoring time.

28 Mar 2002 13:45 and 28 Mar 2002 06:01 would return true.

booleanisSameInstant(final Date date1, final Date date2)

Checks if two date objects represent the same instant in time.

This method compares the long millisecond time of the two objects.

booleanisSameInstant(final Calendar cal1, final Calendar cal2)

Checks if two calendar objects represent the same instant in time.

This method compares the long millisecond time of the two objects.

DateparseDate(final String str, final String... parsePatterns)

Parses a string representing a date by trying a variety of different parsers.

The parse will try each parse pattern in turn.

DateparseDate(final String str, final Locale locale, final String... parsePatterns)

Parses a string representing a date by trying a variety of different parsers, using the default date format symbols for the given locale.

The parse will try each parse pattern in turn.

DateparseDateStrictly(final String str, final String... parsePatterns)

Parses a string representing a date by trying a variety of different parsers.

The parse will try each parse pattern in turn.

Dateround(final Date date, final int field)

Rounds a date, leaving the field specified as the most significant field.

For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if this was passed with HOUR, it would return 28 Mar 2002 14:00:00.000.

Calendarround(final Calendar date, final int field)

Rounds a date, leaving the field specified as the most significant field.

For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if this was passed with HOUR, it would return 28 Mar 2002 14:00:00.000.

Dateround(final Object date, final int field)

Rounds a date, leaving the field specified as the most significant field.

For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if this was passed with HOUR, it would return 28 Mar 2002 14:00:00.000.

DatesetDays(final Date date, final int amount)
Sets the day of month field to a date returning a new object.
DatesetHours(final Date date, final int amount)
Sets the hours field to a date returning a new object.
DatesetMilliseconds(final Date date, final int amount)
Sets the miliseconds field to a date returning a new object.
DatesetMinutes(final Date date, final int amount)
Sets the minute field to a date returning a new object.
DatesetMonths(final Date date, final int amount)
Sets the months field to a date returning a new object.
DatesetSeconds(final Date date, final int amount)
Sets the seconds field to a date returning a new object.
DatesetYears(final Date date, final int amount)
Sets the years field to a date returning a new object.
CalendartoCalendar(final Date date)
Converts a Date into a Calendar .
Datetruncate(final Date date, final int field)

Truncates a date, leaving the field specified as the most significant field.

For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 13:00:00.000.

Calendartruncate(final Calendar date, final int field)

Truncates a date, leaving the field specified as the most significant field.

For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 13:00:00.000.

Datetruncate(final Object date, final int field)

Truncates a date, leaving the field specified as the most significant field.

For example, if you had the date-time of 28 Mar 2002 13:45:01.231, if you passed with HOUR, it would return 28 Mar 2002 13:00:00.000.

inttruncatedCompareTo(final Calendar cal1, final Calendar cal2, final int field)
Determines how two calendars compare up to no more than the specified most significant field.
inttruncatedCompareTo(final Date date1, final Date date2, final int field)
Determines how two dates compare up to no more than the specified most significant field.
booleantruncatedEquals(final Calendar cal1, final Calendar cal2, final int field)
Determines if two calendars are equal up to no more than the specified most significant field.
booleantruncatedEquals(final Date date1, final Date date2, final int field)
Determines if two dates are equal up to no more than the specified most significant field.