Forum Discussion

manoharvankired's avatar
manoharvankired
Qrew Trainee
2 years ago

Remove Weekends between datetime and days, Then show datetime

"I have two fields in my Quickbase application: Request Received Date (a datetime field) and TAT (a numeric field). These fields will be populated based on user input, and I want to add the number of workdays specified in the TAT field to the Request Received Date field. The result should be displayed as a datetime value in a third field. However, I need to exclude weekends from the calculation."

I am currently using a formula to display a datetime value in a third field  ([Request Received Date]) + Days([TAT])



------------------------------
manohar vankireddy
------------------------------
  • try this

    var text RequestDueDate = WeekDayAdd(ToDate([Request Received Date]), [TAT]);

    var text RequestDueTime = ToTimeOfDay([Request Received Date]);

    ToTimeStamp($RequestDueDate, $RequestDueTime) 



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • manoharvankired's avatar
      manoharvankired
      Qrew Trainee

      The data type of the variable changes from datetime in the first line to Var text and then back to datetime in the second line, but in between, it is represented as timeofday.



      ------------------------------
      manohar vankireddy
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        Corrected

        var Date RequestDueDate = WeekDayAdd(ToDate([Request Received Date]), [TAT]);

        var TimeOfDay= RequestDueTime = ToTimeOfDay([Request Received Date]);

        ToTimeStamp($RequestDueDate, $RequestDueTime) 



        ------------------------------
        Mark Shnier (Your Quickbase Coach)
        mark.shnier@gmail.com
        ------------------------------