Forum Discussion
MCFNeil
Qrew Captain
Try something like this (this will handle if its submitted ON the weekend. (starting point, I'll have to come back to deduct the weekend time if its submitted on a Monday kind of thing)
var date SubDateOnly=ToDate([Date/Time Submitted]); //convert date/time to date
var datetime NewSubmitted=ToTimeStamp(ToWeekdayP($SubDateOnly), ToTimeOfDay("11:59 pm")); //create a friday night at midnight timestamp
var datetime AdjustedSubmitted=If(IsWeekday($SubDateOnly), [Date/Time Submitted]), $NewSubmitted); //If its a weekday, use the regular timestamp, otherwise use the friday night time.
$AdjustSubmitted-[Date Created] //put it all together
If your submittals are never greater than a week, then you could add some conditional logic to evaluate the start and end, and if the total is greater than x number (i.e. it includes a weekend time) subtract that 48 hours.
var date SubDateOnly=ToDate([Date/Time Submitted]); //convert date/time to date
var datetime NewSubmitted=ToTimeStamp(ToWeekdayP($SubDateOnly), ToTimeOfDay("11:59 pm")); //create a friday night at midnight timestamp
var datetime AdjustedSubmitted=If(IsWeekday($SubDateOnly), [Date/Time Submitted]), $NewSubmitted); //If its a weekday, use the regular timestamp, otherwise use the friday night time.
$AdjustSubmitted-[Date Created] //put it all together
If your submittals are never greater than a week, then you could add some conditional logic to evaluate the start and end, and if the total is greater than x number (i.e. it includes a weekend time) subtract that 48 hours.
MCFNeil
6 years agoQrew Captain
This might be better:
WeekdaySub (Date d2, Date d1)
Description: Returns the number of weekdays in the interval starting with d1 and ending on the day before d2 (same as subtracting Dates, but the result is the number of weekdays instead of a Duration). It is the inverse of WeekdayAdd.
Example: WeekdaySub([Finish], [Start]) returns the number of weekdays between the dates in the Start and Finish fields.
WeekdaySub(ToDate("6/24/2003"), ToDate("6/20/2003") ) returns 2
WeekdaySub (Date d2, Date d1)
Description: Returns the number of weekdays in the interval starting with d1 and ending on the day before d2 (same as subtracting Dates, but the result is the number of weekdays instead of a Duration). It is the inverse of WeekdayAdd.
Example: WeekdaySub([Finish], [Start]) returns the number of weekdays between the dates in the Start and Finish fields.
WeekdaySub(ToDate("6/24/2003"), ToDate("6/20/2003") ) returns 2