How to retrieve current date time in FEEL in specific timezone?

Hi,

In FEEL expression I want to get current hour and minute in a specific timezone.

To do a check like:

now().hour >= 9 and now().hour < 18

But now() is in “@Etc/UTC” i.e. in UTC time zone. How can I make now() return value in “@Europe/Paris” timezone so that now().hour will have Paris hour and not UTC hour value?

I tried below code but the BPMN deployment fails:

let parisTimeNow = date and time(now(), "Europe/Paris")
in parisTimeNow.hour >= 9 and parisTimeNow.hour < 18

You can convert now() to a specific timezone using the date and time(date, timezone) function, e.g. date and time(now(), "Europe/Paris").hour. I found the following relevant resources:

Does this help? If not, can anyone from the community jump in? :waving_hand:


:light_bulb: Hints: Use the Ask AI feature in Camunda’s documentation to chat with AI and get fast help. Report bugs and features in Camuda’s GitHub issue tracker. Trust the process. :robot:

“let” keyword, “in” keyword, etc are not working for some reason.

(
  {
    parisTimeNow: date and time(now(), "Europe/Paris"),
    isBusinessHours:
      parisTimeNow.hour >= 9 and
      parisTimeNow.hour < 18
  }
).isBusinessHours

The correct FEEL expression is:

{
  parisTimeNow: date and time(now(), "Europe/Paris"),
  isBusinessHours:
    parisTimeNow.hour >= 9 and
    parisTimeNow.hour < 18
}.isBusinessHours

FEEL is an expression language. You can use a context for intermediate results.