Example usage for Java org.apache.commons.lang3.time DateUtils fields, constructors, methods, implement or subclass
The text is from its open source code.
long | MILLIS_PER_SECOND Number of milliseconds in a standard second. |
long | MILLIS_PER_MINUTE Number of milliseconds in a standard minute. |
long | MILLIS_PER_HOUR Number of milliseconds in a standard hour. |
long | MILLIS_PER_DAY Number of milliseconds in a standard day. |
DateUtils() DateUtils instances should NOT be constructed in standard programming. |
Date | addDays(final Date date, final int amount) Adds a number of days to a date returning a new object. |
Date | addHours(final Date date, final int amount) Adds a number of hours to a date returning a new object. |
Date | addMilliseconds(final Date date, final int amount) Adds a number of milliseconds to a date returning a new object. |
Date | addMinutes(final Date date, final int amount) Adds a number of minutes to a date returning a new object. |
Date | addMonths(final Date date, final int amount) Adds a number of months to a date returning a new object. |
Date | addSeconds(final Date date, final int amount) Adds a number of seconds to a date returning a new object. |
Date | addWeeks(final Date date, final int amount) Adds a number of weeks to a date returning a new object. |
Date | addYears(final Date date, final int amount) Adds a number of years to a date returning a new object. |
Date | ceiling(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. |
Calendar | ceiling(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. |
Date | ceiling(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. |
long | getFragmentInDays(final Date date, final int fragment) Returns the number of days within the fragment. |
long | getFragmentInDays(final Calendar calendar, final int fragment) Returns the number of days within the fragment. |
long | getFragmentInHours(final Date date, final int fragment) Returns the number of hours within the fragment. |
long | getFragmentInHours(final Calendar calendar, final int fragment) Returns the number of hours within the fragment. |
long | getFragmentInMilliseconds(final Date date, final int fragment) Returns the number of milliseconds within the fragment. |
long | getFragmentInMilliseconds(final Calendar calendar, final int fragment) Returns the number of milliseconds within the fragment. |
boolean | isSameDay(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. |
boolean | isSameDay(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. |
boolean | isSameInstant(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. |
boolean | isSameInstant(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. |
Date | parseDate(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. |
Date | parseDate(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. |
Date | parseDateStrictly(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. |
Date | round(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. |
Calendar | round(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. |
Date | round(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. |
Date | setDays(final Date date, final int amount) Sets the day of month field to a date returning a new object. |
Date | setHours(final Date date, final int amount) Sets the hours field to a date returning a new object. |
Date | setMilliseconds(final Date date, final int amount) Sets the miliseconds field to a date returning a new object. |
Date | setMinutes(final Date date, final int amount) Sets the minute field to a date returning a new object. |
Date | setMonths(final Date date, final int amount) Sets the months field to a date returning a new object. |
Date | setSeconds(final Date date, final int amount) Sets the seconds field to a date returning a new object. |
Date | setYears(final Date date, final int amount) Sets the years field to a date returning a new object. |
Calendar | toCalendar(final Date date) Converts a Date into a Calendar . |
Date | truncate(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. |
Calendar | truncate(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. |
Date | truncate(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. |
int | truncatedCompareTo(final Calendar cal1, final Calendar cal2, final int field) Determines how two calendars compare up to no more than the specified most significant field. |
int | truncatedCompareTo(final Date date1, final Date date2, final int field) Determines how two dates compare up to no more than the specified most significant field. |
boolean | truncatedEquals(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. |
boolean | truncatedEquals(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. |