Jump to content
Server Maintenance This Week. ×

Time to Words


This topic is 5452 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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" )

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

This topic is 5452 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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