What are the benefits/pitfalls of creating a total time attribute as a decimal vs using the date time function?

Kia ora Everyone!   We want to create an input field that allows staff to put in the total hours worked on a job. I have heard it’s easier to manipulate a decimal – in what situations? I am curious in general about people's opinions and experiences of working with both.    (I have already read the Date-time functions How-to by Ryan Mocke, and a couple other articles about date time, but am really interested in the pro’s and con’s of each)   For the context of our situation:  - The client is currently using “1.75” to represent “1 hour 45 minutes” - They would like all the time inputs to be formatted the same way. - We will be working with calculating the time between, but still need to override any automatic calculations. Cheers, Kitti    
1 answers

Pretty reasonable answer by ChatGPT :-)


The choice largely depends on your specific needs and user preferences.

1. Decimal Values (e.g., 1.75 for 1 hour 45 minutes):


  • Simplicity: Decimal values are easy to input and understand. Users can quickly type in the hours worked, and calculations are straightforward.

  • Easy Arithmetic: Performing calculations with decimal values is often simpler and more intuitive. You can easily add and subtract hours worked.

  • Consistency: If all time inputs use the same decimal format, it ensures consistency in data entry.


  • Limited Precision: Decimal values are less precise when it comes to representing minutes. In your example, 1.75 represents 1 hour 45 minutes, but you can't represent more granular time intervals like 1 hour 52 minutes and 30 seconds without additional complexity.

  • Potential Confusion: Decimal values may confuse users who are used to traditional time formats, especially when working with non-standard intervals.

2. Hours and Minutes (e.g., 1 hour 45 minutes):


  • Precision: Using hours and minutes allows for precise representation of time intervals, including seconds if needed.

  • Readability: It's more human-readable and intuitive, especially for people who are accustomed to expressing time in this format.

  • Flexibility: You can easily accommodate various time intervals without much effort.


  • Data Entry Complexity: Users may take slightly longer to input time values in this format, especially if they need to specify seconds as well.

  • Arithmetic Complexity: Performing calculations like addition and subtraction of time intervals can be more complex when dealing with hours and minutes, but it's manageable with the Mendix date functions available. 

For your specific situation, where the client is currently using decimal values like "1.75" to represent time, it may be practical to stick with this format for consistency, especially if users are already accustomed to it. However, you should also provide clear instructions or a user-friendly interface for data entry and ensure that calculations between time intervals are handled accurately, considering both the whole hours and the minutes.

If users find the decimal format confusing or if there's a need for more precision, you might consider allowing both formats and converting between them as needed. This can provide a balance between simplicity and precision while accommodating user preferences.