Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
MarcoARaymundo
Creator III
Creator III

Days to Year Months Days

Hi!

Anyone know how to transform days to years months days? (ex: 400 days >> 1year 1month 5days) where: year=365, month=30.

Tks

1 Solution

Accepted Solutions
Anonymous
Not applicable

This works:

div(400,365) &  ' Years ' & div(mod(400,365),30) & ' months ' & mod(mod(400,365),30) & ' days'

Just replace this 400 everywhere with the field name.

View solution in original post

2 Replies
Anonymous
Not applicable

This works:

div(400,365) &  ' Years ' & div(mod(400,365),30) & ' months ' & mod(mod(400,365),30) & ' days'

Just replace this 400 everywhere with the field name.

b_garside
Partner - Specialist
Partner - Specialist

I too have found this to work. On occasion, I noticed the days will be off by a day or two. Probably due to some months not adhering to an average of 30.x. I've been looking for a way to accommodate that using this same type of formula...using Mod or fMod.