Brian Dunning's FileMaker Custom Functions

TimeAsDecimal ( xTime )

Convert time into decimal

  Average rating: 4.2 (26 votes) Log in to vote

Tony Tanevski   Tony Tanevski
Hi-Voltage Melbourne
http://hi-voltage.com.au/services/filemaker/

Share on Facebook Share on Twitter

  Sample input:
TimeAsDecimal ( 2:30 )
  Sample output:
2.5

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Convert hours into decimal

Enjoy,
Tony Tanevski
Hi-Voltage, Melbourne Australia

 

Comments

Bernard Moreau   Bernard Moreau, Borchtlombeek, Belgium.
Oct 26, 2015
Hour(xTime) + Minute(xTime) / 60
should work too, isn't it ?
 
comment   comment, VR
Oct 28, 2015
Or simply:

Time / 3600
 
Tony Tanevski   Tony Tanevski, Melbourne
Oct 28, 2015
Time / 3600 does work, but needs to be rounded as it can return multiple decimal places. i.e. 1:24:53s returns 1.4147222222222222

Whereas my function disregards the seconds completely - it just depends on whether you want to include seconds or not.
 
comment   comment, VR
Oct 28, 2015
Well, using your calculation, 00:01:00 will return 0.0166666666666667. Ignoring the seconds has nothing with this - all it accomplishes is making the calculation more complicated and the result less precise.
 
Tony Tanevski   Tony Tanevski, Melbourne
Oct 28, 2015
Yes you are right :)
 
Thomas Hellwig   Thomas Hellwig, Germany
Dec 26, 2015
So why don't you delete the wrong CF "round(xTime / 3600, 2)"?
 
Tony Tanevski   Tony Tanevski, Melbourne, Australia
Dec 26, 2015
No need to delete the custom function as it has been corrected.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: