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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Year conversion in script

I have a column with the following date format: YYYYMMDD, and I would like to take the years of this column in the script, but with the function year (column_name) it returns me a number 52620 something like that, I wonder what is the correct method the year to get such a column. Thank you.

2 Replies
nagaiank
Specialist III
Specialist III

Yiu may try

Left(column_name,4)

or

Year(Date(Date#(column_name,'YYYYMMDD')))

MayilVahanan

Hi,

     Try like this,

     In script:

     Load *,Year(Date(Date#(DateField,'YYYYMMDD'),'YYYY/MM/DD')) as Year from tablename;

     (0r)

     Can you post a sample?

Hope it helps

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