Jump to content
  • 0

Display Age as Years,Months


Leigh
 Share

Question

I would like to calculate age as years and months and display the result in a field in tabular report. I can already display just the age in years, or just the age in months in fields, but I don't want to see 438 months as a persons age as an example.  I want to display both together as years,months. How can I do this?

Thanks

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi Leigh, you can try to use this query in your calculated field:

SELECT CAST(DATEDIFF(YEAR,'[@field:DOB]',GETDATE()) AS VARCHAR(10)) + '.' + CAST(DATEDIFF(MONTH,'[@field:DOB]',GETDATE())-(DATEDIFF(YEAR,'[@field:DOB]',GETDATE())*12) AS VARCHAR(10)) AS Age

I reference [@field:DOB] as my birthdays are saved in that field. You would need to replace every instance of [@field:DOB] with your field name parameter using picker tool.

I found this query on http://stackoverflow.com/questions/30048923/how-to-calculate-age-from-date-of-birth-in-years-months-format

Ariel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...