1/30/2024 0 Comments Chronological age definitionSo I made 3 new variables from each date variable made up of the day, month and year. However, I need the format of the age in years, months and days between the two dates. It takes into account the actual unit lengths according to the calendar but still uses a constant for the number of units to add.Ĭompute agechr=datediff(aw2, dob, 'days'). You might also be interested in the DATESUM function, which adds a fixed number of units - days, months, whatever, to a date. DATEDIFF takes the calendar into account, but the subsequent calculations use a fixed number of days for years and months. Where delta is the datediff value with "days" as the unit.īut you have to decide how long a month is. If you want a datelike form, you can compute the parts using the mod function, e.g., However, that is not itself a date: it is a duration and, therefore, would not have a date format. So that matches the age calculation that applies if you are trying to buy a drink or get a driver's license.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |