Skip 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.

Time to Words

Featured Replies

Short story: I have a field that adds up the time field on a layout. It displays the results in hours and minutes, which looks ridiculous as the hours runs in to the 10,000s.

I need a function that turns these hours and minutes into years, months, days, hours and minutes. For example, 12,009:34 becomes say 0 Years 8 Months, 12 Days, 14 Hours and 34 Minutes.

(I understand the function will give a text result which is ok, and I am NOT looking for a compare time function - I've found too many of these). I'm guessing the function will be a mess of Case clauses but it's too complex for me to figure out.

Heeeellllllp!

(PS Please don't reply telling me the example is wrong, I know, it's an example).

You can't convert such a value to years and months as these have a different value depending on the year or months used.

Here is a quick one - you need to double check it as it's late here and my maths is a bit slow!

use "s" as the parameter passed to it - must be numeric. The highest value we can convert to is a Week (as we know how many secs are in a week!)

---------

Let

(

[

w= Int (s/ 604800) ; r=Mod ( s; 604800) ;

d= Int (r/ 86400 ); r=Mod ( r;86400) ;

h= Int (r/3600); r=Mod (r;3600) ;

m=Int (r/60); s=Mod (r ; 60)

]

;

w & " Weeks " & d & " Days " & h & " Hours " & m & " Minutes " & s & " Seconds" )

---------------------

  • Author

Thanks. It don't work - I get the error "A number, text constant..." appear.

I see the general idea but my field data is in hours and minutes...no seconds. Also doesn't this display the equivalent values ie 1 week = 7 days = 168 hours. I want the following

170 hours to show as

1 week, 0 days, 2 hours, 0 minutes.

868 hours, 23 minutes to show as

5 weeks, 1 day, 4 hours, 23 minutes.

I take your point about months and years but I'm happy to assume that each month is 30 days and each year 365...no rants people about the inaccuracy of the calendar! Thanks for your help.

Edited by Guest

If you see the general idea, what's stopping you from adapting it to your needs?

Notes:

1. A time field converted a number is always the number of seconds;

2. I would use Div ( n ; d ) instead of Int ( n / d ).

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.