Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Extract year from date field - QlikSense

Hi,

I have date field in the following format: 6/29/2017 10:35 AM.

I want to extract the year from the field, i try the function year but it doesn't work.

Any Idea?

Thank you!

1 Solution

Accepted Solutions
Highlighted

Try this

Year(Date#(FieldName, 'M/D/YYYY hh:mm TT')) as Year

View solution in original post

10 Replies
Highlighted

Try this

Year(Date#(FieldName, 'M/D/YYYY hh:mm TT')) as Year

View solution in original post

Highlighted
Partner
Partner

maybe this:

Year(Date#(FieldName, 'MM/DD/YYYY hh:mm TT')) as Year

Highlighted
Creator
Creator

Great ! it's work - Thank you!

Highlighted
Creator
Creator

Thank you

Highlighted
Contributor II
Contributor II

My date is in the below format :

2019-07-28 00:00:00.0000000       

and when I use your code the year shows as empty. Could you help me to solve the issue?

Highlighted
Master
Master

to extract the year you can use this verison :

Year(Date#('2019-07-28 00:00:00.0000000', 'YYYY-MM-DD hh:mm:ss.0000000')) as Year
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Highlighted
Contributor II
Contributor II

Thank you, its works but what about if I have many dates  in my Excel sheet and I want to show in the filter  all years not only 2019.

Highlighted
Master
Master

you just have to change the hard date to the  your date field name

like

Year(Date#([Your_Date], 'YYYY-MM-DD hh:mm:ss.0000000')) as Year
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Highlighted
Contributor II
Contributor II

I have more than 10000 date from 2000 to 2019 so there is way to show only year in the filttrt ?