Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Calculating dates


Bob Ratcliffe

Recommended Posts

I purchase various IT equipment in school and want to be able to know how old various pieces of kit are. I tried this at a very simple level without any success. I basically want an initial installation date (which is just a date field) and then a current date field, but I want it to tell me the number of years and months. This by the way is my first visit to the site, so any suggestions would be much appreciated.

Link to comment
Share on other sites

Your current date field must be an unstored calculation field. If it is not unstored it will not update its value from day to day.

 

Then subtract the first date from the current date field to get days. If you want years and months, do the math.

Link to comment
Share on other sites

I basically want an initial installation date (which is just a date field) and then a current date field, but I want it to tell me the number of years and months.

 

Hi Bob,

 

Here is a formula I use to show the number of years, months and days old a child is. Substitute your field *InstallationDate* for my field DateofBirth and this should work for you. If you don't need the number of days, eliminate the last paragraph of the formula along with the ampersand at the end of the second paragraph.

 

GetAsText(Year(Get(CurrentDate)) - Year(DateofBirth) - Case(GetAsNumber(Get(CurrentDate))

 

GetAsText(Mod(Month(Get(CurrentDate)) - Month(DateofBirth) + 12 - Case(Day(Get(CurrentDate))

 

GetAsText(Day(Get(CurrentDate)) - Day(DateofBirth) + Case(Day(Get(CurrentDate)) >= Day(DateofBirth); 0; Day(Get(CurrentDate)- Day(Get(CurrentDate)))

 

 

HTH,

 

Michele

Link to comment
Share on other sites

Hi Bob,

 

Here is a formula I use to show the number of years, months and days old a child is. Substitute your field *InstallationDate* for my field DateofBirth and this should work for you. If you don't need the number of days, eliminate the last paragraph of the formula along with the ampersand at the end of the second paragraph.

 

GetAsText(Year(Get(CurrentDate)) - Year(DateofBirth) - Case(GetAsNumber(Get(CurrentDate))

 

GetAsText(Mod(Month(Get(CurrentDate)) - Month(DateofBirth) + 12 - Case(Day(Get(CurrentDate))

 

GetAsText(Day(Get(CurrentDate)) - Day(DateofBirth) + Case(Day(Get(CurrentDate)) >= Day(DateofBirth); 0; Day(Get(CurrentDate)- Day(Get(CurrentDate)))

 

 

HTH,

 

Michele

 

Thanks Michele, this works brilliantly! I really appreciate it.

Bob

Link to comment
Share on other sites

  • 1 year later...

I know this is an old post but I just wanted to thank everyone in the thread for the help.

 

You gave this newbie a big grin and confidence boost with Filemaker Pro! smiley-laughing

Link to comment
Share on other sites



×
×
  • Create New...

Important Information

Terms of Use