public class DateTimeStaticExtensions
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.time.Period |
between(java.time.Period type,
java.time.YearMonth startInclusive,
java.time.YearMonth endExclusive)
Obtains a Period consisting of the number of years and months between two
YearMonth instances. |
static java.time.Period |
between(java.time.Period type,
java.time.Year startInclusive,
java.time.Year endExclusive)
Obtains a Period consisting of the number of years between two
Year instances. |
static java.time.LocalDate |
parse(java.time.LocalDate type,
java.lang.CharSequence text,
java.lang.String pattern)
Parse text into a
LocalDate using the provided pattern. |
static java.time.LocalDateTime |
parse(java.time.LocalDateTime type,
java.lang.CharSequence text,
java.lang.String pattern)
Parse text into a
LocalDateTime using the provided pattern. |
static java.time.LocalTime |
parse(java.time.LocalTime type,
java.lang.CharSequence text,
java.lang.String pattern)
Parse text into a
LocalTime using the provided pattern. |
static java.time.MonthDay |
parse(java.time.MonthDay type,
java.lang.CharSequence text,
java.lang.String pattern)
Parse text into a
MonthDay using the provided pattern. |
static java.time.OffsetDateTime |
parse(java.time.OffsetDateTime type,
java.lang.CharSequence text,
java.lang.String pattern)
Parse text into an
OffsetDateTime using the provided pattern. |
static java.time.OffsetTime |
parse(java.time.OffsetTime type,
java.lang.CharSequence text,
java.lang.String pattern)
Parse text into an
OffsetTime using the provided pattern. |
static java.time.Year |
parse(java.time.Year type,
java.lang.CharSequence text,
java.lang.String pattern)
Parse text into a
Year using the provided pattern. |
static java.time.YearMonth |
parse(java.time.YearMonth type,
java.lang.CharSequence text,
java.lang.String pattern)
Parse text into a
YearMonth using the provided pattern. |
static java.time.ZonedDateTime |
parse(java.time.ZonedDateTime type,
java.lang.CharSequence text,
java.lang.String pattern)
Parse text into a
ZonedDateTime using the provided pattern. |
static java.time.ZoneOffset |
systemDefault(java.time.ZoneOffset type)
Returns the
ZoneOffset currently associated with the system default ZoneId . |
public static java.time.LocalDate parse(java.time.LocalDate type, java.lang.CharSequence text, java.lang.String pattern)
LocalDate
using the provided pattern.
Note: the order of parameters differs from versions of this method for the legacy Date class.type
- placeholder variable used by Groovy categories; ignored for default static methodstext
- String to be parsed to create the date instancepattern
- pattern used to parse the textjava.lang.IllegalArgumentException
- if the pattern is invalidjava.time.format.DateTimeParseException
- if the text cannot be parsedDateTimeFormatter
,
LocalDate.parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)
public static java.time.LocalDateTime parse(java.time.LocalDateTime type, java.lang.CharSequence text, java.lang.String pattern)
LocalDateTime
using the provided pattern.
Note: the order of parameters differs from versions of this method for the legacy Date class.type
- placeholder variable used by Groovy categories; ignored for default static methodstext
- String to be parsed to create the date instancepattern
- pattern used to parse the textjava.lang.IllegalArgumentException
- if the pattern is invalidjava.time.format.DateTimeParseException
- if the text cannot be parsedDateTimeFormatter
,
LocalDateTime.parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)
public static java.time.LocalTime parse(java.time.LocalTime type, java.lang.CharSequence text, java.lang.String pattern)
LocalTime
using the provided pattern.type
- placeholder variable used by Groovy categories; ignored for default static methodstext
- String to be parsed to create the date instancepattern
- pattern used to parse the textjava.lang.IllegalArgumentException
- if the pattern is invalidjava.time.format.DateTimeParseException
- if the text cannot be parsedDateTimeFormatter
,
LocalTime.parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)
public static java.time.MonthDay parse(java.time.MonthDay type, java.lang.CharSequence text, java.lang.String pattern)
MonthDay
using the provided pattern.type
- placeholder variable used by Groovy categories; ignored for default static methodstext
- String to be parsed to create the date instancepattern
- pattern used to parse the textjava.lang.IllegalArgumentException
- if the pattern is invalidjava.time.format.DateTimeParseException
- if the text cannot be parsedDateTimeFormatter
,
MonthDay.parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)
public static java.time.OffsetDateTime parse(java.time.OffsetDateTime type, java.lang.CharSequence text, java.lang.String pattern)
OffsetDateTime
using the provided pattern.type
- placeholder variable used by Groovy categories; ignored for default static methodstext
- String to be parsed to create the date instancepattern
- pattern used to parse the textjava.lang.IllegalArgumentException
- if the pattern is invalidjava.time.format.DateTimeParseException
- if the text cannot be parsedDateTimeFormatter
,
OffsetDateTime.parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)
public static java.time.OffsetTime parse(java.time.OffsetTime type, java.lang.CharSequence text, java.lang.String pattern)
OffsetTime
using the provided pattern.type
- placeholder variable used by Groovy categories; ignored for default static methodstext
- String to be parsed to create the date instancepattern
- pattern used to parse the textjava.lang.IllegalArgumentException
- if the pattern is invalidjava.time.format.DateTimeParseException
- if the text cannot be parsedDateTimeFormatter
,
OffsetTime.parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)
public static java.time.Year parse(java.time.Year type, java.lang.CharSequence text, java.lang.String pattern)
Year
using the provided pattern.type
- placeholder variable used by Groovy categories; ignored for default static methodstext
- String to be parsed to create the date instancepattern
- pattern used to parse the textjava.lang.IllegalArgumentException
- if the pattern is invalidjava.time.format.DateTimeParseException
- if the text cannot be parsedDateTimeFormatter
,
Year.parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)
public static java.time.YearMonth parse(java.time.YearMonth type, java.lang.CharSequence text, java.lang.String pattern)
YearMonth
using the provided pattern.type
- placeholder variable used by Groovy categories; ignored for default static methodstext
- String to be parsed to create the date instancepattern
- pattern used to parse the textjava.lang.IllegalArgumentException
- if the pattern is invalidjava.time.format.DateTimeParseException
- if the text cannot be parsedDateTimeFormatter
,
YearMonth.parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)
public static java.time.ZonedDateTime parse(java.time.ZonedDateTime type, java.lang.CharSequence text, java.lang.String pattern)
ZonedDateTime
using the provided pattern.type
- placeholder variable used by Groovy categories; ignored for default static methodstext
- String to be parsed to create the date instancepattern
- pattern used to parse the textjava.lang.IllegalArgumentException
- if the pattern is invalidjava.time.format.DateTimeParseException
- if the text cannot be parsedDateTimeFormatter
,
ZonedDateTime.parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)
public static java.time.ZoneOffset systemDefault(java.time.ZoneOffset type)
ZoneOffset
currently associated with the system default ZoneId
.type
- placeholder variable used by Groovy categories; ignored for default static methodsZoneId.systemDefault()
public static java.time.Period between(java.time.Period type, java.time.Year startInclusive, java.time.Year endExclusive)
Year
instances.
The months and days of the Period will be zero.
The result of this method can be a negative period if the end is before the start.type
- placeholder variable used by Groovy categories; ignored for default static methodsstartInclusive
- the start Year
, inclusive, not nullendExclusive
- the end Year
, exclusive, not nullPeriod.between(LocalDate, LocalDate)
public static java.time.Period between(java.time.Period type, java.time.YearMonth startInclusive, java.time.YearMonth endExclusive)
YearMonth
instances.
The days of the Period will be zero.
The result of this method can be a negative period if the end is before the start.type
- placeholder variable used by Groovy categories; ignored for default static methodsstartInclusive
- the start YearMonth
, inclusive, not nullendExclusive
- the end YearMonth
, exclusive, not nullPeriod.between(LocalDate, LocalDate)