Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
jaymerry
Creator
Creator

Convert YY to YYYY

Hello all,

I'm trying to convert year in "YY" format to "YYYY" format in my script, but it doesn't seem possible.

Have you any ideas ?

Thanks for your help,

Jaymerry

1 Solution

Accepted Solutions
jaymerry
Creator
Creator
Author

Hi all,

Thanks to your answers I have found the following script (file name : "xxxx-MMYY.xslx":

date

(date#(left(right(filename(),7),2), 'YY'),'YYYY')&left(right(filename(),9),2) as YYYYMM

Thanks for your help,

Jaymerry







View solution in original post

5 Replies
Not applicable

Hi,

Your date format is having year in YYYY format then you have to just write Year(Date).

Regards,

Ravi

Anonymous
Not applicable

It will be:
=date(date#(Year, 'YY'),'YYYY')

(Where field Year is in YY format)

jaymerry
Creator
Creator
Author

Hi Ravi,

I have a date from a filename with this format 'MMYY' and I try to have 'YYYYMM'.

It's not really a problem for the month (left function) but for the year, I don'treally know how to do.

Thanks for your help,

Jaymerry

jaymerry
Creator
Creator
Author

Hi all,

Thanks to your answers I have found the following script (file name : "xxxx-MMYY.xslx":

date

(date#(left(right(filename(),7),2), 'YY'),'YYYY')&left(right(filename(),9),2) as YYYYMM

Thanks for your help,

Jaymerry







Anonymous
Not applicable

Techically it is the same date(date#()). In your case, a more effective way (at least shorter and clearer) is:

date(date#(right(filename(),4),'MMYY'),'YYYYMM')