Calculate dates to show next day

Hello there! I’m currently developing a flight booking application, and things have been going pretty smoothly. However, I’ve recently encountered an obstacle that’s been challenging to overcome. I will try my best to explain the issue as good as possible since I’m really bad with that, please ask questions if it’s not understandable.

On certain occasions, your flight may arrive on the following day. For instance, your departure time is on January 23 at 22:00, and you arrive at your destination on January 24 at 08:30. I would like to add the feature that, as soon when the flight arrives the next day, a text will appear “+1” next to the arrival time.

I tried to use this formula: arrival time - depart time: format as days:ceiling. But then it doesn’t always result in +1 because the depart and arrival times are too close to each other.

I used this formula: arrival time - depart time: format as days:ceiling,
which results in for example 16-03-2023 16:45 - 15-03-2023 22:20 = 0.8 (ceiling makes it 1). For the example, it’s working properly. However sometimes the result is 0.8 but the flight arrives on the same day, so it isn’t functioning properly.

Is there a formula that only calculates the date and not the date & time? So the formula will be 16-03-2023 - 15-03-2023 = 1? And if not, is there another way to fix this?


Scherm­afbeelding 2023-03-07 om 20.59.56

Hi there, @jedesno… I’m not sure if I understand your post correctly, but if I do, check out the :rounded down to operator, and try rounding your dates down to date. Using that operator will set the time for each date to 12:00am, basically taking the different times out of the mix so you can just evaluate the dates.

Hope this helps.

Best…
Mike

1 Like

Well, I hoped that this worked. But I can only apply the :rounded down to, to the first date…
Scherm­afbeelding 2023-03-07 om 22.12.08

Try enabling the experimental parentheses feature on the Settings >> Versions tab and see if that makes it possible (I believe it should).

You’re amazing :star_struck:, I wouldn’t find it without your help.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.