Dynamic date with dynamic number of days | Community
Skip to main content
Adobe Employee
April 10, 2026
Solved

Dynamic date with dynamic number of days

  • April 10, 2026
  • 3 replies
  • 108 views

Hi,

I have a requirement where I want to pass dynamic number in place of <dynamic number> in below expression.
 

toDateTimeOnly(concat(toString(toDateOnly(nowWithDelta(<dynamic number>, "days"))),"T10:00:00"))


This dynamic number is being calculated in below manner - 
 

toInteger(
  (
    (toInteger(
      toDateTime(
        concat(
          toString(
            #{
              ExperiencePlatform.ProfileFieldGroup.profile._acssandboxgdcthree.EventReminders.all(
                currentDataPackField.id == ${supplementalId}
              ).at(0).reminderDate
            }
          ),
          "T00:00:00.000Z"
        )
      )
    ))
    -
    (toInteger(
      toDateTime(
        concat(
          toString(
            toDateTimeOnly(
              toDateOnly(now())
            )
          ),
          ".000Z"
        )
      )
    ))
  ) / 86400000
) - 14


I tried merging these two like this -
 

toDateTimeOnly(concat(toString(toDateOnly(nowWithDelta(

toInteger(
(
(toInteger(
toDateTime(
concat(
toString(
#{
ExperiencePlatform.ProfileFieldGroup.profile._acssandboxgdcthree.EventReminders.all(
currentDataPackField.id == ${supplementalId}
).at(0).reminderDate
}
),
"T00:00:00.000Z"
)
)
))
-
(toInteger(
toDateTime(
concat(
toString(
toDateTimeOnly(
toDateOnly(now())
)
),
".000Z"
)
)
))
) / 86400000
) - 14

, "days"))),"T10:00:00"))


However, it gives error - 

The expression is invalid : You cannot use the word 'toInteger' like this because it is a keyword of the language. Please, add quotes to fix your expression.


Can somebody help me understand if there’s any workaround to get my code working?

@Pulkit_Jain_  ​@Jennifer_Dungan ​@AutumnE ​@Nick_Hilton ​@ktronolone ​@ChristianeRo1 

Best answer by Pulkit_Jain_

@gkodag 

Suggest that you log a support ticket. We will share the working expression

3 replies

Pulkit_Jain_
Adobe Employee
Adobe Employee
April 13, 2026

@gkodag 

Seems that nowWithDelta() is breaking because the parser does not allow complex nested expressions (like toInteger()) inside its arguments.

Workaround:
You can skip nowWithDelta() entirely and do the math directly in milliseconds, to avoid the parser error 

toDateTimeOnly(
toDateTime(
toInteger(now())
+ (
<your_dynamic_days_expression>
* 86400000
)
)
)

 

gkodagAdobe EmployeeAuthor
Adobe Employee
April 13, 2026

Thanks ​@Pulkit_Jain_ , I’ll try this and let you know.

gkodagAdobe EmployeeAuthor
Adobe Employee
April 13, 2026

Hi ​@Pulkit_Jain_ 

Below is the updated code and I get this error now - 

The expression is invalid : You cannot use the character '+' like this because it is a keyword of the language. Please, add quotes to fix your expression.
 

toDateTimeOnly(
toDateTime(
toInteger(now())
+ (
(

toInteger(
  (
    (toInteger(
      toDateTime(
        concat(
          toString(
            #{
              ExperiencePlatform.ProfileFieldGroup.profile._acssandboxgdcthree.EventReminders.all(
                currentDataPackField.id == ${supplementalId}
              ).at(0).reminderDate
            }
          ),
          "T00:00:00.000Z"
        )
      )
    ))
    -
    (toInteger(
      toDateTime(
        concat(
          toString(
            toDateTimeOnly(
              toDateOnly(now())
            )
          ),
          ".000Z"
        )
      )
    ))
  ) / 86400000
) - 14
)

* 86400000
)
)
)

 

ReenaJohn
Community Advisor
Community Advisor
April 16, 2026

@gkodag  can you give this a try - 

toDateTimeOnly(
  concat(
    toString(
      toDateOnly(
        nowWithDelta(
          dateDiff(
            toDateTime(concat(toString(#{ExperiencePlatform.ProfileFieldGroup.profile._acssandboxgdcthree.EventReminders.all(currentDataPackField.id == ${supplementalId}).at(0).reminderDate}), "T00:00:00.000Z")),
            now(),
            "days"
          ) - 14, 
          "days"
        )
      )
    ),
    "T10:00:00"
  )
)

gkodagAdobe EmployeeAuthor
Adobe Employee
April 21, 2026

Hi everyone,

Thanks for helping me out on this. I have got the working expression with help of engineering. -

toDateTimeOnly(toDateTime((currentTimeInMillis())+((toInteger(toDateTime(concat(toString(#{ExperiencePlatform.ProfileFieldGroup.profile._acssandboxgdcthree.EventReminders.all(currentDataPackField.id==${supplementalId}).at(0).reminderDate}),"T00:00:00.000"))))-(toInteger(toDateTime(concat(toString(toDateOnly(now())),"T00:00:00.000"))))-(14*86400000))))