This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 45c3b1e5650d Update simple doc
45c3b1e5650d is described below
commit 45c3b1e5650d3e9ed6ed9c840ff541bfa8803fec
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Jan 24 18:26:36 2026 +0100
Update simple doc
---
.../main/docs/modules/languages/pages/simple-language.adoc | 14 ++++++++++++--
.../java/org/apache/camel/language/simple/SimpleTest.java | 4 ++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git
a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
index 78fd54f961f4..23889d70e326 100644
---
a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
+++
b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
@@ -324,11 +324,21 @@ And the `not` function is function to inverse the boolean
value.
[width="100%",cols="10%,10%,80%",options="header",]
|====
|Function |Response Type |Description
-|`date-with-timezone:command:timezone:pattern` | `String` | Date formatting
using `java.text.SimpleDateFormat` timezones and patterns. See `data:command`
function for additional documentation on the commands.
-|`date:command:pattern` | `String` | Date formatting using
`java.text.SimpleDateFormat` patterns. See `data:command` function for
additional documentation on the commands.
|`date:command` | `Date` | Evaluates to a `java.util.Date` object. Supported
commands are: `now` for current timestamp, `exchangeCreated` for the timestamp
when the current exchange was created, `header.xxx` to use the `Long/Date`
object in the header with the key xxx. `variable.xxx` to use the `Long/Date` in
the variable with the key xxx. `exchangeProperty.xxx` to use the `Long/Date`
object in the exchange property with the key xxx. `file` for the last modified
timestamp of the file (on [...]
+|`date:command:pattern` | `String` | Date formatting using
`java.text.SimpleDateFormat` patterns. See `data:command` function for
additional documentation on the commands.
+|`date-with-timezone:command:timezone:pattern` | `String` | Date formatting
using `java.text.SimpleDateFormat` timezones and patterns. See `data:command`
function for additional documentation on the commands.
|====
+The date functions is used for parsing and formatting with date and times.
+
+For example to get the current time use `${date:now}` which is returned as a
`java.util.Date` object.
+If you want to format this to a String value, you can use the pattern command,
such as `${date:now:hh:mm:ss}`.
+And to get the time 8 hours in the future `${date:now+8h:hh:mm:ss}`.
+
+There is also a timezone supported function so you can say
`date-with-timezone:header.birthday:GMT+8:yyyy-MM-dd'T'HH:mm:ss:SSS`.
+This will get the `Date` object from the header with key birthday, and format
that using the given pattern in the timezone GMT+8.
+
+
=== Math & Numeric Functions
[width="100%",cols="10%,10%,80%",options="header",]
diff --git
a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
b/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
index 1c1269c06810..cdf0bbd2a64f 100644
---
a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
+++
b/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
@@ -665,6 +665,10 @@ public class SimpleTest extends LanguageTestSupport {
public void testDateNow() {
Object out = evaluateExpression("${date:now:hh:mm:ss a}", null);
assertNotNull(out);
+ out = evaluateExpression("${date:now:hh:mm:ss}", null);
+ assertNotNull(out);
+ out = evaluateExpression("${date:now-2h:hh:mm:ss}", null);
+ assertNotNull(out);
}
@Test