java.text.SimpleDateFormat .
Using a StringLookup from the StringLookupFactory:
StringLookupFactory.INSTANCE.dateStringLookup().lookup("yyyy-MM-dd");
Using a StringSubstitutor:
StringSubstitutor.createInterpolator().replace("... ${date:yyyy-MM-dd} ..."));
The above examples convert "yyyy-MM-dd" to today's date, for example, "2019-08-04".
Public access is through StringLookupFactory.
StringLookupFactory
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final DateStringLookup | INSTANCE
Defines the singleton for this class. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private String | Returns: The formatted date.the date to format. dateMillis, final String the format string for format)SimpleDateFormat.Formats the given |
| public String | Returns: The value of the environment variable.the format to use. If null, the default key)DateFormat will be used.Implements org. Formats the current date with the format given in the key in a format compatible with
|
| INSTANCE | back to summary |
|---|---|
| pack-priv static final DateStringLookup INSTANCE Defines the singleton for this class. | |
| DateStringLookup | back to summary |
|---|---|
| private DateStringLookup() No need to build instances for now. | |
| formatDate | back to summary |
|---|---|
| private String formatDate(final long dateMillis, final String format) Formats the given
| |
| lookup | back to summary |
|---|---|
| public String lookup(final String key) Implements org. Formats the current date with the format given in the key in a format compatible with
| |