How do I round to the 15th or 30th of the month using a duration calculation field?

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

For example:

Start Date: 1/08/15

Finish Date: Start Date + 10 days = 1/18/2015

I want this to round up to 1/30/2015

If the finish date was 1/12/15, I would want it to round to 1/15/2015

Photo of Lynne8817

Lynne8817

  • 600 Points 500 badge 2x thumb

Posted 4 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,572 Points 50k badge 2x thumb
Try this. It uses formula variables fro ease of readability. http://www.quickbase.com/user-assistance/Default.html#formula_variables.html




var date FinishRaw = [Start date]+days(10);

var number YYYY=Year($FinishRaw);

var number MM = Month($FinishRaw);

var number DD = If(Day($FinishRaw)<=15,15,Day(LastDayOfMonth($FinishRaw));

Date($YYYY, $MM, $DD)