Revit Deadline! Calculate Days Between Dates

I'd like to thank Joseph and Robin for their comments on Revit Calendar at revitforum.org. And a huge thank you goes to Oscar Lopez, curator of my morning ritual BIM WORLD. Seeing my own post there was like being on TV!

Edit 140618:
I'm a long time fan and follower of whatrevitwants. (As you can see from my top links list.)
It's an honor to be there! Thank you Luke!

at revitforum.org:

-You can use it in an evil or good way right now. Put a Comments label in it, adjust a date and place it on views in a work shared environment saying..
Good: "Hey don't forget the party!"
Evil: "Yes! That deadline was yesterday!

-Yes, for Evil. I have also been thinking about doing some kind of project planning in Revit. For example if you make "Comment Objects" that a project manager or lead designer, with very little Revit experience, can place on drawings and fill in with date and actions they can be scheduled. This gives a clear overview of what needs to be done, by whom, when and if actions have been completed or not. It would be very useful to have Date and Time available as parameters in Revit so that actions approaching deadlines could be shown in ever brighter colours as the moment of death or glory approaches...


D_GEN_DEADLINE.rfa (Revit 2015)

The deadline family has 2 data entry parameters:
DateA and DateB. Family expects DateA to be earlier than DateB by default.

It has 2 check parameters:
DateAcheck and DateBcheck. These parameters show how the family interprets the dates we've entered.

And there's a txtMessage parameter with 6 possible outcomes.

While I was looking for a solution I've found Julian Day in wikipedia:
Julian Day is the continuous count of days since the beginning of the Julian Period used primarily by astronomers.

A count for each Date means I can subtract one from other to find the days in between. This would be easier than I've thought!

I also didn't want to have 6 entry parameters(y/m/d) for two dates so I've made 2 integer parameters which I parse into y/m/d and correct with DRV(drive) parameters and concatenate back into check parameters.

DateA (Integer Parameter)

year(at least 1 digit)month(2 digits)day(2 digits). So the earliest date you can enter is 10101.
(If you have a deadline before that let me know! :)

Parsing (Probably called something else!) done by getting the correct decimal places.

AyearParse = rounddown(DateA / 10000)
AmonthParse = rounddown(DateA / 100) - (AyearParse * 100)
AdayParse = DateA - (AyearParse * 10000) - (AmonthParse * 100)

I've used the same day / month / yearDRV(drive) parameters from the Revit Calendar.

Julian Day Number

You must compute first the number of years (y) and months (m) since March 1 −4800 (March 1, 4801 BC):

So be it!
Aa = rounddown((14 - AmonthDRV) / 12)
Ay = AyearDRV + 4800 - Aa
Am = AmonthDRV + (12 * Aa) - 3

AJulianDay = AdayDRV + rounddown(((153 * Am) + 2) / 5) + (365 * Ay) + rounddown(Ay / 4) - rounddown(Ay / 100) + rounddown(Ay / 400) - 32045

I've repeated the above steps for DateB.
BJulianDay - AJulianDay is the Droid we are looking for!

Usually I nest formulas when I believe they're working OK to reduce the number of parameters. For readability I didn't do it in this family.

Enjoy!.. Thanks for reading..


  1. I've been looking all day, and can't find a good answer on how to make 'Date A' in your family the Current date. Any thoughts? I can't figure out how to break down the 'get date' parameter into integers.

  2. For "Date A" and "Date B" parameters you have to put an integer in the format YYYYmmDD.
    ie 20161122