# Getting Started

View Only

## Formula to display time billed in months not day

• #### 1.  Formula to display time billed in months not day

Posted 10-20-2022 10:31
Hello,

I'm trying to create a formula that will take the date entered within field in my application named, "Date", and the current date and display the amount of time between the two in months not days.

I used ToDays(Today()-ToDate([Date])) which returned the value within days.

------------------------------
Christopher Angulo
------------------------------

• #### 2.  RE: Formula to display time billed in months not day

Posted 10-20-2022 10:50
QuickBase knows what the current date and time is and certainly we can have a formula to calculate the time between the current time in any date time field.

But in your case you want to compare the current date and time to affixed date. What time of day would you want to use for that? Like 12 o'clock noon for example?

------------------------------
mark.shnier@gmail.com
------------------------------

• #### 3.  RE: Formula to display time billed in months not day

Posted 10-20-2022 11:16
Thank you for the quick response I really appreciate it. And my apologies for not explaining it too well. So my "date" field gets dates imported through CSV files which are the dates that our service began to our customers. In the spreadsheet we currently have a formula that takes the date of which service started and displays how many months have passed based on todays date since our service started to said customer.

So I was trying to find a way to display the duration that has passed between the date field we enter and today's date in months. I was able to calculate the amount of days not months.

Thank you!

------------------------------
Christopher Angulo
------------------------------

• #### 4.  RE: Formula to display time billed in months not day

Posted 10-20-2022 11:23
Edited by Mark Shnier (Your Quickbase Coach) 10-20-2022 11:25
I posted a better response below.

------------------------------
mark.shnier@gmail.com
------------------------------

• #### 5.  RE: Formula to display time billed in months not day

Posted 10-20-2022 11:25
Actually this one is probably better to use.
var date SD=[MY Date Field];
var date ED=Today();

(Year(\$ED)-Year(\$SD)-1)*12 // start off with 12 times the number of fully completed years
+If(Month(\$ED)>=Month(\$SD),12,0) //add 12 months if the last year was fully completed
+ If((Month(\$ED)>=Month(\$SD)),Month(\$ED)-Month(\$SD),12+Month(\$ED)-Month(\$SD)) // add the number of months between the month numbers.
-If(Day(\$ED)<Day(\$SD),1,0) // but if the day did not catch up to the start date's day number, then subtract 1.

------------------------------