Bob Ratcliffe Posted June 24, 2008 Share Posted June 24, 2008 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 More sharing options...
AHunter3 Posted June 24, 2008 Share Posted June 24, 2008 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 More sharing options...
Molson Posted June 24, 2008 Share Posted June 24, 2008 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 More sharing options...
Bob Ratcliffe Posted June 24, 2008 Author Share Posted June 24, 2008 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 More sharing options...
pantrygirl Posted August 10, 2009 Share Posted August 10, 2009 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 More sharing options...
Recommended Posts