Forum Discussion

DougCrandall's avatar
DougCrandall
Qrew Cadet
4 months ago

Duration of 48 hours starting on a workday

Greetings. I am trying to create a Due Date/Time field that would show 48 hours from the Date Created for a record, but need to take into account work hours.

Right now my formula is [Date Created]+Hours(48), which shows the date/time 48 hours later, but if the record is created Saturday morning at 10am, for example, I would need the countdown to start as of Monday morning 8am. I thought about using ToWorkDate, then WorkDateAdd, but I believe I would lose the time component, so am not sure that will work for the date/time field type.

Any suggestions?

  • not tested but try this

    ToTimeStamp(     // this function returns a date / time result when given a date and a Time of day

    ToWeekDayN(ToDate([Date Created]),  // this function will bump the date ahead if it falls on a weekend. 

    ToTimeOfDay([DateCreated]) // just the time of date portion of a date/time field

    + Hours(48)

    • DougCrandall's avatar
      DougCrandall
      Qrew Cadet

      Thank you, Mark. This was what I needed. Quickbase accepted this function with an extra set of parenthesis and it appears to work, though I'll create a record on the weekend just to make sure.  And I also learned from your example that I can comment within a line, which I had never done before. :-)

      ToTimeStamp(
      ToWeekDayN(ToDate([Date Created])) ,
      ToTimeOfDay([Date Created])
      + Hours(48))