Automation using expression with dates

Hi,
I’ve created a very simple automation that checks if current time is less than curret date & 6am, put 3 in shift number, if between 6am and 3pm, put 1, else put 2.
I used the following expression :
texttodatetime(datetimetotext(@Automation Info.Current Date And Time , ‘DD-MM-YYYY’, ‘Asia/Jerusalem’) + ’ 06:00am’, ‘DD-MM-YYYY hh:mma’, ‘Asia/Jerusalem’)

The condition works like that :
image

image

So, it doesn’t do nothing, the rest of automation is doing other things like create a record and put other values there accourding to other conditions, but this one, not, can anyone help me if I can use such expression like I did or shell I use any other type of expression for knowledge of time differences ?

Thank you,
Amit Berku

Hi Amit!

I checked out your expression and everything looks good there (it was working for me when I played with this in app editor).

That being said, I wonder if you are still having this issue? I ask because Tulip rolled out a change in r275 to change {{TextToDateTime}} expression in apps to be more strict about the string dates it accepts. (For example: {{2021/02/01}} would error for format {{YYYY-MM-DD}}, the text format must be {{YYYY/MM/DD}}).

This caused some previous expressions to break and the team quickly reverted the change in r275.2 so this is no longer a concern, but I am wondering if that is what was causing the issue here.

Let me know if you are still having an issue and we can continue to debug together :slight_smile:

Hi Beth,
We had some issues regarding upgrade of version r275 and r276, still in version r274 now, hopping we will have a new WORKING version soon, than I will check out those dates issues.
Thank you for your answer.

Amit

1 Like