DateTimeDiff result in decimal years?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello!
I'm using a formula to calculate the number of years between dates - what I want is the number of years to hundredths of a year. This would be like using a YEARFRAC function in Excel.
Current formula: DateTimeDiff(DateTimeToday(), [Seniority Date], "years")
For [Seniority Date] = 2001-08-20, the formula returns 16; I need it to return 16.24.
I tried using the following with no luck:
Round(DateTimeDiff(DateTimeToday(), [Seniority Date], "years"), .01)
EDIT: I thought about using days instead of years and dividing by 365 - that doesn't account for leap years, and the dates span decades.
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I ended up dividing the number of days by 365.25 rather than 365, which gets me to the correct number of years to the hundredth of a year (which is what I needed for this).
Still, the ability to calculate decimal years from DateTimeDiff would be helpful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello, new to Alteryx,
I have a similar question, I am doing the DateTimeDiff and want the output to be in 2 place decimal. Mine is coming back in whole #s.
Thanks!
