Skip to content

CAP Java: date/time functions#2527

Open
agoerler wants to merge 8 commits intomainfrom
javaDateTime
Open

CAP Java: date/time functions#2527
agoerler wants to merge 8 commits intomainfrom
javaDateTime

Conversation

@agoerler
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread java/working-with-cql/query-api.md Outdated
Copy link
Copy Markdown
Contributor

@t-bonk t-bonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Only thing i noticed is that I don't understand the advantage of scalar functions...

@smahati
Copy link
Copy Markdown
Contributor

smahati commented Apr 28, 2026

todo:

  • fix snippet errors
  • fix broken link from release notes

Comment thread java/working-with-cql/query-api.md
Comment thread java/working-with-cql/query-api.md Outdated
Co-authored-by: René Jeglinsky <rene.jeglinsky@sap.com>

The `substring` method creates an expression for substring extraction from a string value. Extract a substring from a specified starting position of either a given length or to the end of the string. The first position is zero.
```java
date.extract(ChronoField.DAY_OF_MONTH)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that be correct as the snippet checker suggests?

Suggested change
date.extract(ChronoField.DAY_OF_MONTH)
date.extract(ChronoField.DAY_OF_MONTH);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's also fine. With semicolon it's a "statement". Without a semicolon it's an "expression". Both are valid syntactical constructs in Java. But a "statement" should do something useful like assign the value, e.g.

CqnValue day = date.extract(ChronoField.DAY_OF_MONTH);

Without a semicolon it's it's clear that the "expression" is just a building block that can be used to build something useful with.

##### `concat`

See [`Concat`](#string-expressions) String Expression
See [`Concat Expression`](#concat-expression).
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we also keep the anchor #string-expressions to avoid breaking a link someone might have bookmarked


The `substring` method creates an expression for substring extraction from a string value. Extract a substring from a specified starting position of either a given length or to the end of the string. The first position is zero.
```java
date.extract(ChronoField.DAY_OF_MONTH)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's also fine. With semicolon it's a "statement". Without a semicolon it's an "expression". Both are valid syntactical constructs in Java. But a "statement" should do something useful like assign the value, e.g.

CqnValue day = date.extract(ChronoField.DAY_OF_MONTH);

Without a semicolon it's it's clear that the "expression" is just a building block that can be used to build something useful with.

Comment on lines +1756 to +1757
#### Concat Expression
###### String Expressions
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is only one String Expression, namely Concat hence I simplified the hierarchy but we can also revert to

String Expressions

Concat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants