public class DateTimeStaticExtensions
This class defines new static extension methods which appear on normal JDK Date/Time API (java.time) classes inside the Groovy environment.
Type Params | Return Type | Name and description |
---|---|---|
|
static Period |
between(Period type, Year startInclusive, Year endExclusive) Obtains a Period consisting of the number of years between two Year instances. |
|
static Period |
between(Period type, YearMonth startInclusive, YearMonth endExclusive) Obtains a Period consisting of the number of years and months between two YearMonth instances. |
|
static LocalDate |
parse(LocalDate type, CharSequence text, String pattern) Parse text into a LocalDate using the provided pattern. |
|
static LocalDateTime |
parse(LocalDateTime type, CharSequence text, String pattern) Parse text into a LocalDateTime using the provided pattern. |
|
static LocalTime |
parse(LocalTime type, CharSequence text, String pattern) Parse text into a LocalTime using the provided pattern. |
|
static MonthDay |
parse(MonthDay type, CharSequence text, String pattern) Parse text into a MonthDay using the provided pattern. |
|
static OffsetDateTime |
parse(OffsetDateTime type, CharSequence text, String pattern) Parse text into an OffsetDateTime using the provided pattern. |
|
static OffsetTime |
parse(OffsetTime type, CharSequence text, String pattern) Parse text into an OffsetTime using the provided pattern. |
|
static Year |
parse(Year type, CharSequence text, String pattern) Parse text into a Year using the provided pattern. |
|
static YearMonth |
parse(YearMonth type, CharSequence text, String pattern) Parse text into a YearMonth using the provided pattern. |
|
static ZonedDateTime |
parse(ZonedDateTime type, CharSequence text, String pattern) Parse text into a ZonedDateTime using the provided pattern. |
|
static ZoneOffset |
systemDefault(ZoneOffset type) Returns the ZoneOffset currently associated with the system default ZoneId. |
Obtains a Period consisting of the number of years between two 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 nullObtains a Period consisting of the number of years and months between two 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 nullParse text into a 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 textParse text into a 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 textParse text into a 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 textParse text into a 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 textParse text into an 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 textParse text into an 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 textParse text into a 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 textParse text into a 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 textParse text into a 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 textReturns the ZoneOffset currently associated with the system default ZoneId.
type
- placeholder variable used by Groovy categories; ignored for default static methods