Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert date to year

I have a date in the format 56321, would like to be able to convert a column in another year and month, separated, how can I do this?

Labels (1)
1 Solution

Accepted Solutions
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

for counting the age it is better to use this expression:

Floor(Num(Today() - DateofBirth)/365,25)

that means, 365,25 is the number of days a year with a quarter day for 29th of February and floor truncs the decimals

Greetings

Martina

View solution in original post

5 Replies
MayilVahanan
MVP
MVP

Hi,

     Date(56321,'YYYY/MM') gives 2054/03

     or

    

     Date(56321,'YYYY') gives 2054 for Month, Date(56321,'MM') gives 03

   

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks, but i have a age column, for example: -54950, how do I convert to, for example, 50 years, 49 years?

MayilVahanan
MVP
MVP

HI,

    

    

     Try like this,

     =age(fabs(-54950),num(today())) gives 37.

     Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
CELAMBARASAN
Partner - Champion
Partner - Champion

Explain about age conversion with the data you provided little more breifer?

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

for counting the age it is better to use this expression:

Floor(Num(Today() - DateofBirth)/365,25)

that means, 365,25 is the number of days a year with a quarter day for 29th of February and floor truncs the decimals

Greetings

Martina