Forum Discussion

KristyWilliford's avatar
KristyWilliford
Qrew Assistant Captain
6 years ago

I would like to add three working days to a date time field.How should I do it

4 Replies

  • AustinK's avatar
    AustinK
    Qrew Commander
    That's a tough one. Generally with a date/time field you would just add hours to it for the days but that doesn't work for business days. There might be a way to do this if you had a formula that determined the day of the week and if it was Friday it would add 120 hours which should result in it being placed on Wednesday of the next week, if that makes sense.

    I've seen a formula for figuring out the day of the week on this forum before so it should just be a search away. There might be a better way to do it though.
  • not tested but try this


    var datetime MyDateTime = [my date time field];
    var date MyDate = ToDate($MyDateTime ]);
    var timeofday Time = ToTimeOfDay $MyDateTime;
    var date  NewDate = WeekDayAdd($MyDate, 3)

    ToTimeStamp($NewDate, $Time)

    If there is a problem with the formula, please post the formula and the error message.





    • WaldoRemijn's avatar
      WaldoRemijn
      Qrew Member
      Had to make a few technical changes to your formula but it works perfectly:

      var datetime MyDateTime = [my date time field];
      var date MyDate = ToDate($MyDateTime);
      var timeofday Time = ToTimeOfDay($MyDateTime);
      var date NewDate = WeekdayAdd($MyDate, 3);

      ToTimestamp($NewDate, $Time)

      ------------------------------
      Waldo Remijn
      Founder
      Go Improve Ltd
      Sevenoaks United Kingdom
      ------------------------------