Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I would like to define a new field, that would subtract two different times, and give me the difference.

I have field A, the arrival time, and field B, the departure time. I want to have C show how many hours are in between them.

All my events last less than a day.

The problem I'm having is that Field A and Field B, are in Time format. Field C, is a calculation that has (Field :( - (Field A). What I want is for field C to give me the difference, but what it's doing is it's giving me a negative number because it's going back a whole day from AM to PM.

Can anyone give me a tip on what to change?

Thanks.

Time doesn't seem to want to subtract directly...

(GetAsNumber(arrivalTime) - GetAsNumber(departureTime)) / 3600

Or just

GetAsNumber(arrivalTime - departureTime) / 3600

Time doesn't seem to want to subtract directly...

Since when? A simple Arrival - Departure works fine for me.

I suspect the problem is with events crossing midnight, which can be handled by:

Arrival - Departure + 86400 * ( Departure > Arrival )

You can leave the result as Time, and format the display to your liking, or - if you want decimal hours - make it a Number and divide by 3600.

Don't know, didn't seem to work for me... kept giving me much larger neg values

i.e. 1pm - 11am = -22 (i don't remember if that's actually what it spat out, but it was much larger than it should have been).

Don't know, seems to work now, and you're probably right re the midnight thing -- but why does it make the assumption?

What assumption would that be?

I don't know i'm too confused to think about this right now.

  • Author

Since when? A simple Arrival - Departure works fine for me.

I suspect the problem is with events crossing midnight, which can be handled by:

Arrival - Departure + 86400 * ( Departure > Arrival )

You can leave the result as Time, and format the display to your liking, or - if you want decimal hours - make it a Number and divide by 3600.

That is exactly the problem I'm having. For events crossing midnight, it's counting backwards, or adding 12 to it and giving me a negative result. I tried your method and it still seems to be doing that.

It works perfectly for me.

Departure 1:00 PM (or even 1 PM)

Arrival 11:00 AM (or even 11 AM)

Calculation (result is time) = Arrival - Departure + 86400 * ( Departure > Arrival )

Result: 22 hours or 22:00:00

Nothing I do can make it run negative or break. Are you sure all three fields are time? And are you sure you don't have Arrival and Departure reversed? That's what it sounds like you're doing. But even so, Comment's calculation would not break.

This thread seems to be afflicted with things that "seem not to work".

timeDiff.fp7.zip

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.