Hello everyone! I’m making a greeting message that changes based on the time of the day.
My thought process is to use NOW(“”) to get the current date and time, and use GET_DATETIME_COMPONENT(DATE, “hour”) to get the hour. However, the NOW(“”) won’t work with the GET_DATETIME_COMPONENT function.
Would you help me how I can extract “hour” from current time?
May I ask you one more question? I’m trying to make the IF condition to be NOW(“hh”) between 05 and 11. I used && for two conditions to be true, but the formula is not accepting the second “<” (invalid syntax: unexpected “<”
Oh yeah and the note about this relation: <=… < this means that 11:14 would already evaluate to Good Afternoon, however, you might want to tell the user Good Afternoon only after 12, so either has to set the upper limit to “12”, or do this: <= which is the greater than this includes the values up till 11:59.
And so on… Please note that if a formula is more than 4 lines long there might be issues when you click on a different line in the formula editor, so I would suggest using your arrow keys to navigate the formula editor. Also, the highlighting feature helps a lot when trying to figure out which part you are at.
@Mihaly_Toth Thank you so much for detailed explanation and also how to use the nested IF. That was going to be my next step to include all “Good Morning,” “Good Afternoon,” and “Good Evening.”
I’m not getting the local time back. In the AppGyver documentation, I found the SET_TIMEZONE function, but this doesn’t allow “hh” inside of NOW() function.
SET_TIMEZONE(NOW(), LOCAL_TIMEZONE())
Another function is FORMAT_DATETIME_LOCAL(). I tried this with “hh” in it.
Let me try to contribute here.
I would assign the NOW("hh") value to a page variable called “now”
Then try SET_TIMEZONE(pageVar.now), LOCAL_TIMEZONE())
I was about to write this formula as this is the “go with” super simple solution, but I am glad that you have figured it out yourself. That’s the fun part about the journey here. Good luck with the next steps.