I am a little puzzled here.
I need to check if a dateTime value is past a given hour of the day. But there is an issue, since it has an unpleasant behaviour : since we updated to summer time, it is wrong by 1 hour !
In my record type (and user interface), the dateTime will display "6/8/2026 5:48 PM GMT+02:00", so I assume my timezone has a two hours offset.
However, when I use function "timezone()", it gives "60", which would be adequate (and it did for a while!) when we would still be with winter time.
Why doesn't timezone() give 120?
How is this possible ? Is it a known bug ? (we are using release 25.3).
Do I have to create a specific constant with the right hour and remove the days to allow calculation?
Here is what I have now:
a!localVariables( local!dateBegin: now(), local!heure: hour(local!dateBegin) + timezone()/60, local!minute: minute(local!dateBegin), local!isAfter17h: or( local!heure > 17, and(local!heure = 17, local!minute > 0) ), local!dayEnd: todate(local!dateBegin) + if(local!isAfter17h, 1, 0),
[...]
but it is wrong between 5 and 6 PM
Discussion posts and replies are publicly visible
Have you tried just using local()?
timezone() returns only the winter-time base offset and does not automatically account for daylight saving time.Use local!heure: hour(local(local!dateBegin)) local()
Seems like you try to do your own date&time calculations. Most of the time, this is a bad idea. I tried to cover most of the date&time related tricks in this blog post: https://appian.rocks/2023/02/13/working-with-time-in-appian/
I was able to fix the issue by comparing a datetime() with a now() normalized with local().
a!localVariables( local!nowLocal: local(now()), local!today17: datetime( year(local!nowLocal), month(local!nowLocal), day(local!nowLocal), 17, 0, 0 ),
local!isAfter17h: local!nowLocal > local!today17,
local!dayEnd: todate(local!nowLocal) + if(local!isAfter17h, 1, 0),