Raymond created CAMEL-19800:
-------------------------------
Summary: Simple language: Extend date offsets according to
java.text.SimpleDateFormat
Key: CAMEL-19800
URL: https://issues.apache.org/jira/browse/CAMEL-19800
Project: Camel
Issue Type: New Feature
Affects Versions: 3.20.6
Reporter: Raymond
In the simple language, you can get a formatted date with the following syntax:
date:_command:pattern_
For example:
{color:#1f2328}${date:now:yyyy-MM-dd HH:mm:ss:SSS}{color}
It's also possible to offset the date like this:
{color:#1f2328}$\{date:now{{{}+1h30m{}}}:yyyy-MM-dd HH:mm:ss:SSS}{color}
The following offsets are currently implemented:
Seconds: ${date:now+1s:yyyy-MM-dd HH:mm:ss:SSS}
Minutes: ${date:now+1m:yyyy-MM-dd HH:mm:ss:SSS}
Hours: ${date:now+1h:yyyy-MM-dd HH:mm:ss:SSS}
Days: ${date:now+1d:yyyy-MM-dd HH:mm:ss:SSS}
I think it would be more consistent and complete to use the letters as used in
{{{}java.text.SimpleDateFormat{}}}.
Milliseconds: ${date:now+1S:yyyy-MM-dd HH:mm:ss:SSS}
Seconds: ${date:now+1s:yyyy-MM-dd HH:mm:ss:SSS}
Minutes: ${date:now+1m:yyyy-MM-dd HH:mm:ss:SSS}
Hours: ${date:now+1H:yyyy-MM-dd HH:mm:ss:SSS}
Days: ${date:now+1d:yyyy-MM-dd HH:mm:ss:SSS}
Months: ${date:now+1M:yyyy-MM-dd HH:mm:ss:SSS}
Years: ${date:now+1y:yyyy-MM-dd HH:mm:ss:SSS}
Note that millisecond, hour, and month are here written with a capital letter.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)