Modifier and Type | Field and Description |
---|---|
static String |
DATE_PATTERN
The ISO date pattern.
|
static String |
DATE_TIME_PATTERN
The ISO date time pattern.
|
Constructor and Description |
---|
StringConverter() |
Modifier and Type | Method and Description |
---|---|
static Date |
toDate(String s)
Translate String to Date.
|
static Date |
toDate(String s,
String pattern)
Translate String to Date.
|
static LocalDate |
toLocalDate(String s)
Translate String to LocalDate.
|
static LocalDate |
toLocalDate(String s,
String pattern)
Translate String to LocalDate.
|
static LocalDateTime |
toLocalDateTime(String s)
Translate String to LocalDateTime.
|
static LocalDateTime |
toLocalDateTime(String s,
String pattern)
Translate String to LocalDateTime.
|
static String |
toString(Date d)
Translate Date to String.
|
static String |
toString(LocalDate d)
Translate LocalDate to String.
|
static String |
toString(LocalDate d,
String pattern)
Translate LocalDate to String.
|
static String |
toString(LocalDateTime dt)
Translate LocalDateTime to String.
|
static String |
toString(LocalDateTime dt,
String pattern)
Translate LocalDateTime to String.
|
public static final String DATE_PATTERN
public static final String DATE_TIME_PATTERN
@Nullable public static String toString(@Nullable Date d)
d
- Date@Nullable public static Date toDate(@Nullable String s) throws StringParsingException
s
- StringStringParsingException
- If Date cannot be parsed.@Nullable public static Date toDate(@Nullable String s, @Nonnull String pattern) throws StringParsingException
s
- Stringpattern
- The Date patternStringParsingException
- If Date cannot be parsed.@Nullable public static String toString(@Nullable LocalDate d)
d
- Date@Nullable public static String toString(@Nullable LocalDate d, @Nonnull String pattern)
d
- The local datepattern
- The target String pattern@Nullable public static LocalDate toLocalDate(@Nullable String s) throws StringParsingException
s
- StringStringParsingException
- If LocalDate cannot be parsed.@Nullable public static LocalDate toLocalDate(@Nullable String s, @Nonnull String pattern) throws StringParsingException
s
- Stringpattern
- The LocalDate patternStringParsingException
- If LocalDate cannot be parsed.@Nullable public static String toString(@Nullable LocalDateTime dt)
dt
- The local date time@Nullable public static String toString(@Nullable LocalDateTime dt, @Nonnull String pattern)
dt
- The local date timepattern
- The target String pattern@Nullable public static LocalDateTime toLocalDateTime(@Nullable String s) throws StringParsingException
s
- StringStringParsingException
- If LocalDateTime cannot be parsed.@Nullable public static LocalDateTime toLocalDateTime(@Nullable String s, @Nonnull String pattern) throws StringParsingException
s
- Stringpattern
- The LocalDateTime patternStringParsingException
- If LocalDateTime cannot be parsed.Copyright © 2021 SAP SE. All rights reserved.