public final class DateTimeUtilities
extends java.lang.Object
Temporal date and date-time types supported by iCalendar. DATE DATE_WITH_LOCAL_TIME DATE_WITH_LOCAL_TIME_AND_TIME_ZONE DATE_WITH_UTC_TIME: see iCalendar RFC 5545, page 32-33
includes methods to format a Temporal representing a DateTimeType as a String
Modifier and Type | Class and Description |
---|---|
static class |
DateTimeUtilities.DateTimeType |
Modifier and Type | Field and Description |
---|---|
static DateTimeUtilities.DateTimeType |
DEFAULT_DATE_TIME_TYPE
Default DateTimeType to use when none is specified.
|
static java.time.format.DateTimeFormatter |
LOCAL_DATE_FORMATTER |
static java.time.format.DateTimeFormatter |
LOCAL_DATE_TIME_FORMATTER |
static java.util.Comparator<java.time.temporal.Temporal> |
TEMPORAL_COMPARATOR
Compares two temporals of the same type
|
static java.util.Comparator<java.time.temporal.Temporal> |
TEMPORAL_COMPARATOR2
Compares two temporals of the LocalDate, LocalDateTime and ZonedDateTime
Makes LocalDate at start of day.
|
static java.time.format.DateTimeFormatter |
ZONED_DATE_TIME_FORMATTER |
static java.time.format.DateTimeFormatter |
ZONED_DATE_TIME_UTC_FORMATTER |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
checkScheduleConflict(VEvent vEvent,
java.util.List<VEvent> vEvents)
Check if schedule conflict exists for
OPAQUE events
using default check quantity |
static java.lang.String |
checkScheduleConflict(VEvent vEvent,
java.util.List<VEvent> vEvents,
int checkQuantity)
Check if schedule conflict exists for
OPAQUE events. |
static java.lang.String |
checkScheduleConflict2(VEvent vEvent,
java.util.List<VEvent> vEvents,
int checkQuantity)
Check if schedule conflict exists for
OPAQUE events. |
static java.lang.String |
dateTimePropertyTag(java.lang.String propertyName,
java.time.temporal.Temporal temporal)
Deprecated.
|
static java.time.DayOfWeek |
dayOfWeekFromAbbreviation(java.lang.String dayOfWeekAbbreviation)
Convert 2-character string to DayOfWeek following below convention:
weekday = "SU" / "MO" / "TU" / "WE" / "TH" / "FR" / "SA"
Corresponding to SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and SATURDAY days of the week.
|
static java.lang.String |
format(java.time.temporal.Temporal temporal)
Deprecated.
|
static java.util.Comparator<java.time.temporal.Temporal> |
getTemporalComparator(java.time.temporal.Temporal t)
Returns correct comparator based on Temporal parameter
|
static boolean |
isAfter(java.time.temporal.Temporal t1,
java.time.temporal.Temporal t2)
Determines if Temporal is after t2
Works for LocalDate, LocalDateTime and ZonedDateTime
|
static boolean |
isBefore(java.time.temporal.Temporal t1,
java.time.temporal.Temporal t2)
Determines if Temporal is before t2
Works for LocalDate, LocalDateTime and ZonedDateTime
|
static java.time.temporal.Temporal |
parse(java.lang.String temporalString,
java.time.ZoneId zone) |
static java.time.temporal.Temporal |
parseOld(java.lang.String temporalString) |
static java.time.temporal.TemporalAmount |
temporalAmountBetween(java.time.temporal.Temporal startInclusive,
java.time.temporal.Temporal endExclusive)
Calculate TemporalAmount between two Temporals.
|
static java.time.temporal.Temporal |
temporalFromString(java.lang.String string)
Parse ISO.8601 string into LocalDate, LocalDateTime or ZonedDateTime Temporal object.
|
static java.lang.String |
temporalToString(java.time.temporal.Temporal temporal)
produced ISO.8601 date and date-time string for given Temporal of type
LocalDate, LocalDateTime or ZonedDateTime
|
static java.time.LocalDateTime |
toLocalDateTime(java.time.temporal.Temporal temporal)
Deprecated.
|
static int |
weekOrdinalInMonth(java.time.temporal.Temporal dateBasedTemporal)
returns week of month.
|
public static final DateTimeUtilities.DateTimeType DEFAULT_DATE_TIME_TYPE
Default DateTimeType to use when none is specified. For example, when a date-only component is converted to a date-time one.
public static final java.time.format.DateTimeFormatter LOCAL_DATE_FORMATTER
public static final java.time.format.DateTimeFormatter LOCAL_DATE_TIME_FORMATTER
public static final java.time.format.DateTimeFormatter ZONED_DATE_TIME_UTC_FORMATTER
public static final java.time.format.DateTimeFormatter ZONED_DATE_TIME_FORMATTER
public static final java.util.Comparator<java.time.temporal.Temporal> TEMPORAL_COMPARATOR
Compares two temporals of the same type
public static final java.util.Comparator<java.time.temporal.Temporal> TEMPORAL_COMPARATOR2
Compares two temporals of the LocalDate, LocalDateTime and ZonedDateTime Makes LocalDate at start of day. Add system default ZoneId to LocalDate and LocalDateTime
public static final java.util.Comparator<java.time.temporal.Temporal> getTemporalComparator(java.time.temporal.Temporal t)
Returns correct comparator based on Temporal parameter
public static boolean isBefore(java.time.temporal.Temporal t1, java.time.temporal.Temporal t2)
Determines if Temporal is before t2 Works for LocalDate, LocalDateTime and ZonedDateTime
t1
- first Temporalt2
- second Temporal (to compare with t1)public static boolean isAfter(java.time.temporal.Temporal t1, java.time.temporal.Temporal t2)
Determines if Temporal is after t2 Works for LocalDate, LocalDateTime and ZonedDateTime
t1
- first Temporalt2
- second Temporal (to compare with t1)public static java.lang.String checkScheduleConflict(VEvent vEvent, java.util.List<VEvent> vEvents)
Check if schedule conflict exists for OPAQUE
events
using default check quantity
vEvent
- event to testvEvents
- existing eventspublic static java.lang.String checkScheduleConflict(VEvent vEvent, java.util.List<VEvent> vEvents, int checkQuantity)
Check if schedule conflict exists for OPAQUE
events.
vEvent
- event to testvEvents
- existing eventscheckQuantity
- amount of recurrences to be testedpublic static java.lang.String checkScheduleConflict2(VEvent vEvent, java.util.List<VEvent> vEvents, int checkQuantity)
Check if schedule conflict exists for OPAQUE
events.
Finds conflict faster, but not necessarily the first conflict that occurs
vEvent
- event to testvEvents
- existing eventscheckQuantity
- amount of recurrences to be testedpublic static int weekOrdinalInMonth(java.time.temporal.Temporal dateBasedTemporal)
returns week of month. For example, a LocalDate representing March 10, 2016 returns 2, for the 2nd Thursday.
dateBasedTemporal
- - date based Temporal, such as LocalDatepublic static java.time.temporal.TemporalAmount temporalAmountBetween(java.time.temporal.Temporal startInclusive, java.time.temporal.Temporal endExclusive)
Calculate TemporalAmount between two Temporals. Both temporals must be the same type and representations of a DateTimeType.
startInclusive
- - the start temporal, not nullendExclusive
- - the end temporal, not nullpublic static java.time.temporal.Temporal parse(java.lang.String temporalString, java.time.ZoneId zone)
public static java.time.temporal.Temporal parseOld(java.lang.String temporalString)
public static java.lang.String temporalToString(java.time.temporal.Temporal temporal)
produced ISO.8601 date and date-time string for given Temporal of type LocalDate, LocalDateTime or ZonedDateTime
temporal
- public static java.time.temporal.Temporal temporalFromString(java.lang.String string)
Parse ISO.8601 string into LocalDate, LocalDateTime or ZonedDateTime Temporal object.
public static java.time.DayOfWeek dayOfWeekFromAbbreviation(java.lang.String dayOfWeekAbbreviation)
Convert 2-character string to DayOfWeek following below convention: weekday = "SU" / "MO" / "TU" / "WE" / "TH" / "FR" / "SA" Corresponding to SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and SATURDAY days of the week.
dayOfWeekAbbreviation
- - 2 character abbreviation representing day of the week@Deprecated public static java.time.LocalDateTime toLocalDateTime(java.time.temporal.Temporal temporal)
Returns LocalDateTime from Temporal that is an instance of either LocalDate, LocalDateTime or ZonedDateTime If the parameter is type LocalDate the returned LocalDateTime is atStartofDay. If the parameter is type ZonedDateTime the zoneID is changed to ZoneId.systemDefault() before taking the LocalDateTime.
@Deprecated public static java.lang.String format(java.time.temporal.Temporal temporal)
produced ISO.8601 date and date-time string for given Temporal of type LocalDate, LocalDateTime or ZonedDateTime
temporal
- @Deprecated public static java.lang.String dateTimePropertyTag(java.lang.String propertyName, java.time.temporal.Temporal temporal)
Produces property name and attribute, if necessary. For example: LocalDate : DTSTART;VALUE=DATE: LocalDateTime : DTSTART: ZonedDateTime (UTC) : DTSTART: ZonedDateTime : DTEND;TZID=America/New_York:
propertyName
- temporal
- - temporal of LocalDate, LocalDateTime or ZonedDateTime