# Calculate time between dates in PARTIAL days or WORKING HOURS?

**URL:** <https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151>\
**Category:** Get Answers\
**Created:** [March 2, 2022, 7:29am UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151 "2022-03-02T07:29:51Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![CharlesP72336](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@CharlesP72336](https://forums.knack.com/u/CharlesP72336)\
**Post date:** [March 2, 2022, 7:29am UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/1 "2022-03-02T07:29:51Z")

</div>

I have a strange and specific need to calculate the number of days, partial days, or possibly just “working hours” between two dates (hours if dates and times are provided for the START and END). Right now I use a number of date fields, and only calculate “whole working days” using the netWorkdays() forumla (thanks for that).

Unfortunately if someone starts and completes work on the SAME DAY, it always calculates as 0 days, instead of SOMETHING. This really is not accurate as if a process is started and finished on the same day, did it take ZERO days, or did it take ONE day? Really it would be more accurate in my case for it to show a HALF a day (0.5 days) as it usually has another process either start, or start and finish on that same day (again accumulating ZERO days making time measurement impossible).

One option could maybe be PARTIAL DAYS, meaning I could calculate using a single fractional like 0.5 so if a task was started on 01/01/2022 at 8:00AM, and finished at 11:59AM on 01/03, it could say 2.5 days, as it would be less than half of the 3rd working day (rounded up). Note that in these examples, the DATES listed are all within Monday-Friday.

Any ideas on how I could go about this? Any comments on measuring time or the weird “ZERO DAYS” I get? I tried experimenting with the “round up” and decimal placements, but nothing in DAYS seems to calculate properly using these (it will just read 2.0 days or 0.0 days depending).

Any ideas, folks?

An even more complex example that could be used:  
An ideal measurement would really be in WORKING HOURS. For example, the business is open Monday-Friday, 8AM-5PM. I would want to start the opening “START TIME” at whatever time the record is created or the time is selected, say 01/01/2022 @ 12PM. If I I completed the task and logged the “END TIME” as 01/03/2022 @ 10AM, I would want it to calculate at 16 total working hours (5 hours on 01/01, 9 hours on 01/02, and 2 hours on 01/03 = 16 hours).

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [March 2, 2022, 12:17pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/2 "2022-03-02T12:17:17Z")

</div>

Hello Charles,

You can try below form  
[https://roberts.knack.com/farmers#calculateworking-hrs/](https://roberts.knack.com/farmers#calculateworking-hrs/)

if that works for you then I will show you a screenshot of how to achieve this.

Regards,  
Sunny Singla  
[ssingla1985@gmail.com](mailto:ssingla1985@gmail.com)

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [March 2, 2022, 3:52pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/3 "2022-03-02T15:52:22Z")

</div>

Look like there is an issue with this.

You can try now.

Regards,  
Sunny Singla

---

<div class="post-metadata">

**Author:** ![CharlesP72336](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@CharlesP72336](https://forums.knack.com/u/CharlesP72336)\
**Post date:** [March 2, 2022, 3:59pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/4 "2022-03-02T15:59:59Z")

</div>

Sunny,

I have not checked this much, but I am completely impressed at the speed of your response. On the surface it sure looks like it is working for me, and I simply divided the number of worked hours by the number of hours in a “work day” and it gives me the “fractional day” I was talking about as well…! I might have to do a few small things to this but it looks great.

As you are a Knack expert and clearly have some knowledge, I may also have some consulting work to do in Knack if you are interested? Specifically I need to start pushing/pulling records or automate the upload of a CSV for import.

![Outlook-04dnigqz.jpg](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/a/aa78972ac648eeb3838f8a55138a0ed2b80c20c5.jpeg)

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [March 2, 2022, 4:09pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/5 "2022-03-02T16:09:48Z")

</div>

Hello Charles,

Yes, sure I’m interested in any knack-related work.

Regards,  
Sunny Singla  
[ssingla1985@gmail.com](mailto:ssingla1985@gmail.com)

---

<div class="post-metadata">

**Author:** ![CharlesP72336](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@CharlesP72336](https://forums.knack.com/u/CharlesP72336)\
**Post date:** [March 2, 2022, 4:29pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/6 "2022-03-02T16:29:38Z")

</div>

Do you have time for a quick phone call or discussion on this solution, and also some future work? I can give you some quick examples and explain how I am using this.

You can tell me about how you might do the work?

![Outlook-04dnigqz.jpg](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/a/aa78972ac648eeb3838f8a55138a0ed2b80c20c5.jpeg)

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [March 2, 2022, 4:31pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/7 "2022-03-02T16:31:30Z")

</div>

Sure  
you can all me on  
+919855089359

---

<div class="post-metadata">

**Author:** ![CharlesP72336](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@CharlesP72336](https://forums.knack.com/u/CharlesP72336)\
**Post date:** [March 2, 2022, 5:07pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/8 "2022-03-02T17:07:43Z")

</div>

Thanks Sunny! I will call you in a few minutes. One additional question:

Can you get the netWorkDays or a variation to calculate a single day or half day instead of ZERO days?

When I enter 03/03 as the start and 03/03 as the end it calculates as ZERO instead of one day

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [March 2, 2022, 5:09pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/9 "2022-03-02T17:09:44Z")

</div>

> [@CharlesP72336](#):
>
> calculates

when you entered same day but time difference then i calculate hours difference + like same day 0 days+  
8am to 5 pm = 9 hr

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/6/6eb1313a81affddf7f57ba964c00ea65faea6e00.png)

Regards,  
Sunny Singla

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [March 2, 2022, 5:10pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/10 "2022-03-02T17:10:43Z")

</div>

we can also change in a formula like if there is same-day then we can show 1 days instead of 0

Regards,  
Sunny Singla

---

<div class="post-metadata">

**Author:** ![CharlesP72336](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@CharlesP72336](https://forums.knack.com/u/CharlesP72336)\
**Post date:** [March 2, 2022, 5:20pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/11 "2022-03-02T17:20:28Z")

</div>

Currently we do not capture the time, but that could work

---

<div class="post-metadata">

**Author:** ![CharlesP72336](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@CharlesP72336](https://forums.knack.com/u/CharlesP72336)\
**Post date:** [March 2, 2022, 5:21pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/12 "2022-03-02T17:21:33Z")

</div>

That would be helpful

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [March 2, 2022, 5:34pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/13 "2022-03-02T17:34:05Z")

</div>

if we don’t want to capture time then it’s easy for us to calculate only days.

---

<div class="post-metadata">

**Author:** ![Nathaniel](https://avatars.discourse-cdn.com/v4/letter/n/ba8739/32.png) [@Nathaniel](https://forums.knack.com/u/Nathaniel)\
**Post date:** [December 17, 2023, 11:22pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/14 "2023-12-17T23:22:50Z")

</div>

Hi Sunny, Can you please share the formula you used to calculate the total hours?

Thank you in advance,  
Nathaniel

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [December 18, 2023, 6:54am UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/15 "2023-12-18T06:54:05Z")

</div>

Hello Nathaniel,

It’s a little complicated. Attaching screenshots

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/4/440fd808dfc78959db498a965d94fdd1a6decc15.png)

StartDateonly and EndDateOnly contain the Date field only with no time like below

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/4/40eacd977b5727bd172cebe97ae4dd751d288926.png)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/2/2448f66e28cba147f7c5004d5f267d13a56078ba.png)

Similarly, StartTimeOnly and EndTimeOnly contain time only

Other fields

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/2/2a887418ad9b0f22241b2c65cb2d39f7aa76c15f.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/9/9f3e82f6d98429042b73abdf4555d13561d2ec90.png)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/0/03d814c6b6e7268881cb175992e5c33f40cf9f9b.png)

Thanks,  
Sunny Singla

---

<div class="post-metadata">

**Author:** ![Rogert\_Carlos](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@Rogert\_Carlos](https://forums.knack.com/u/Rogert_Carlos)\
**Post date:** [July 10, 2024, 10:57am UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/16 "2024-07-10T10:57:52Z")

</div>

Could you spare a moment for a brief phone call or discussion about this solution and upcoming work? I can provide quick examples and explain how I’m implementing updates to the age [calculator tool](https://yashesaplama.com.tr/).

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [July 22, 2024, 4:04pm UTC](https://forums.knack.com/t/calculate-time-between-dates-in-partial-days-or-working-hours/12151/17 "2024-07-22T16:04:16Z")

</div>

Hello Rogert,

Sorry for the delay, Yes we can do a phone call add me on whatapp.  
+919855089359

Regards,  
Sunny Singla  
+919855089359
