Different greeting based on time

Hiya guys, so I’ve been combing over a couple threads here based on the topic but can’t quite get this working and the topics are closed unfortunately.

This one Variables and conditional logic? - #2 by Erik seems to have a solution using UNIX Timestamps, I tried this (probably incorrectly :)) but I can’t seem to get it working.

Anyone have any tips/suggestions on how to approach this?

Thx much

@Victor might be the best guess for this.

1 Like

Hi @tbel,

This question is more complex than it seems at a glance :slight_smile:

To start with: as I know, internally Adalo stores dates as numbers, where integer part is number of days since 01/01/1970, and decimal part is the “fraction of the day passed”. Also, the date-time is stored in UTC+0.
So number like 18788.875 means the date 12 June 2021, 9:00 PM UTC.

If your users are in the same time zone, then you can calculate the fractions for morning, afternoon, evening for this exact time zone, and then provide greeting based on that (I assume you know how to strip off the integer part of Current time).

But if your users are in different time zones, then everything becomes pretty complex, as you need to understand in which time zone user is in.

This is a good idea for a video tutorial :slight_smile:

Best regards, Victor.

2 Likes

@Victor Oh yes please! Adalo is my 1st real go at a no code app or really app dev in general so I’m pretty green here :slight_smile: I’m an artist/athletic coach :smiley:

But yeah, this would make an excellent tutorial, as it’s clearly pretty complex, my users will be starting off in EST for now, but yeah eventually, hopefully globally.

I can see extending beyond simple greetings. Things like wishing users Happy Birthday and such!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.