public class DateUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
formatDate(Calendar calendar)
Formats the given calendar using a standardized date format.
|
static String |
formatDate(Date date)
Formats the given date using a standardized date format.
|
static String |
formatDate(ZonedDateTime zonedDateTime)
Formats the given
ZonedDateTime using a standardized date format. |
static Calendar |
getClonedCalendar(Calendar calendar)
Creates and returns a clone of the given calendar object.
|
static Date |
getNextExactDateEveryInterval(int interval,
TimeUnit timeUnit)
Return the next exact date for a given interval and time unit after the current time.
|
static Date |
getNextExactDateEveryInterval(int interval,
TimeUnit timeUnit,
Calendar calendar)
Return the next exact date given a specific interval and time unit after the specified
Calendar instance. |
static Date |
getNextExactDateEveryInterval(int interval,
TimeUnit timeUnit,
Date date)
Return the next exact date given a specific interval and time unit after the specified
date.
|
static ZonedDateTime |
now()
Returns the current date-time as a
ZonedDateTime, using the system clock. |
public static ZonedDateTime now()
ZonedDateTime, using the system clock.ZonedDateTime for the current date-time, not nullpublic static String formatDate(Calendar calendar)
calendar - the calendar to be formattedpublic static String formatDate(ZonedDateTime zonedDateTime)
ZonedDateTime using a standardized date format.zonedDateTime - the object to be formattedpublic static String formatDate(Date date)
date - the date to be formattedpublic static Date getNextExactDateEveryInterval(int interval, TimeUnit timeUnit)
For example:
interval - the maximum interval for each executiontimeUnit - the given interval's time unitpublic static Date getNextExactDateEveryInterval(int interval, TimeUnit timeUnit, Date date)
For example:
interval - the maximum interval for each executiontimeUnit - the given interval's time unitdate - the source Date to be processedpublic static Date getNextExactDateEveryInterval(int interval, TimeUnit timeUnit, Calendar calendar)
Calendar instance.
For example:
interval - the maximum interval for each executiontimeUnit - the given interval's time unitcalendar - the source Calendar instanceCopyright © 2021. All rights reserved.