We are using the dateTrans function in SAP Cloud Integration (CPI) to convert a datetime value from the format:
yyyy-MM-dd HH:mm:ss
to:
yyyy-MM-dd
However, the dateTrans function is producing an incorrect output.
Input
2026-10-07 18:15:00
Expected Output
2026-10-07
Actual Output
2027-03-07
The input date is being converted to a completely different date, even though the expected behavior is only to remove the time portion and retain the date.
Steps to Reproduce
dateTrans function for date conversion.2026-10-07 18:15:00
yyyy-MM-dd HH:mm:ss to: yyyy-MM-dd
Request clarification before answering.
Hi,
2027-03-07 is exactly what you get when the input format has MM (month) in the time part instead of mm (minutes): the 15 from 18:15 is read as month 15, and month 15 of 2026 is March 2027.
The mapping functions use Java's SimpleDateFormat, which is lenient by default, so instead of failing it just rolls the date over. I ran your input value through SimpleDateFormat with a few patterns:
yyyy-MM-dd HH:mm:ss -> 2026-10-07 (correct)
yyyy-MM-dd HH:MM:ss -> 2027-03-07 (your result)
yyyy-mm-dd HH:MM:ss -> 2027-03-07
YYYY-MM-dd HH:mm:ss -> 2025-12-28 (week year)
yyyy-MM-DD HH:mm:ss -> 2026-01-07 (day of year)So check the input format in the dateTrans settings letter by letter: it must be yyyy-MM-dd HH:mm:ss, with lowercase mm for minutes and lowercase yyyy and dd. Case matters in every letter.
Note: I tested the pattern behavior in plain Java, not on a CPI tenant.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.