Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
fanninam
Creator
Creator

Pull Year from a Date

I'm trying to pull only the year from this date.  The date format is:  01/01/1947 0:00:00

What code statement would I use to pull only the year?

21 Replies
Frank_Hartmann
Master II
Master II

try like that

year(Date('01/01/1947 0:00:00','MM/DD/YYYY h:mm:ss')) or

year(Date(YourDatefield,'MM/DD/YYYY h:mm:ss'))

hope this helps

juan_patrick
Creator
Creator

Hi Amber,

Year function:

year ‒ QlikView

¡Good luck!

Anil_Babu_Samineni

How about this?

Load ..., Year(Date) as Year from Table where Year(Date) = 1947;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
fanninam
Creator
Creator
Author

I've tried all of these below and it's not pulling anything.  I'm getting confused.

fanninam
Creator
Creator
Author

Could it be the AM that is throwing it off?  If so, how would I include the AM portion to the code statement?

1/14/1953  12:00:00 AM

Anil_Babu_Samineni

You can define it as tt for AM and TT for PM ??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Frank_Hartmann
Master II
Master II

can u prepare and upload a sample qvw including your date field?

juan_patrick
Creator
Creator

Try this:

year(floor(YourDatefield))

juan_patrick
Creator
Creator

Another thing,

Where are you doing this? in the load where you connecto to the DB? If yes, do it from a resident table!