Photo by Agê Barros on Unsplash

How To Coda with hours?

converting days into hours

  • Hour()Outputs the hour of the given dateTime as a number.
  • Hours() Outputs a time duration for the specified number of hours.
  • ToHours()Outputs a number of hours for the specified duration.
  • FormatDuration() → not yet officially supported.

Vacation

The issue we face is that in the example someone receives a package of hours to consume. For example 48 hours. These 48 hours can be distributed over various days.

How can we turn 48 into 48 hours?

We face two issues. First the number 48 is a normal number since it is manually typed in. To turn 48 into 48 hours, you can say : Hours(48) but this does not output the right ‘number’. It turns it into two days.

numbers to hours
we apply FormatDuration()
Failing without Hours()

Making Tables Talk

In our set up we have a form, once filled out, an automation subtracts the days as hours from the balance. May the employee not have be in the list, it is added otherwise the balance is modified. The focus is not here on the automation, the filtering, keeping the balance in line, etc.. It is strictly about the hour logic.

the function
getting negative hours — time as number

--

--

I use Coda mainly for (HR) planning & (budget) calculations. Follow me to learn how to Coda with numbers. I blog at least once per week.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Christiaan Huizer

I use Coda mainly for (HR) planning & (budget) calculations. Follow me to learn how to Coda with numbers. I blog at least once per week.