Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

How to convert date format DD-MM-YYYY into Year ?

How to convert date format DD-MM-YYYY into Year ?


Hi All


I have import a raw data file from Excel to Qli View.


I try to convert the imported field name = [Expected Close Date] in order year format YYYY.


I have try to using the below expression :-


//   text(right(Year(date#([Expected Close Date],'DD/MM/YYYY')), 2),'00') as Year,

//   dual(right(Year(date#([Expected Close Date],'DD/MM/YYYY')), 2),'00') as Year,

//   year(today()) - year([Expected Close Date]) + 1                                         as Year,

//   num(right(Year(date#([Expected Close Date],'DD/MM/YYYY')), 2),'00') as Year,

//   dual(right(Year(date#([Expected Close Date],'DD/MM/YYYY')), 2),'00') as Year,

//   Right(year([Expected Close Date]),2)          as Year,


All the above not able to work.


Can some one advise me.


Paul Yeo

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Your format is MM-DD-YYYY, Right? Perhaps this?

Year(Date#([Expected Close Date], 'MM-DD-YYYY')) as Year

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

23 Replies
avinashelite

try like this

subfiled([Expected Close Date],'-' ,3) as Year

paulyeo11
Master
Master
Author

Hi Avinash

Thank you for your sharing , i get below error :-

Error in expression:

SUBFILED is not a valid function


Paul

Anil_Babu_Samineni

I would think this?

Year([Expected Close Date]) as Year

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
paulyeo11
Master
Master
Author

Hi Anil

Thank you for your sharing again.

Your no error but not display any value.

Paul

Anil_Babu_Samineni

Image for field, Please? Don't have access to check

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
surendraj
Specialist
Specialist

Try

Date(Date#([Expected Close Date],'DD/MM/YYYY'),'YYYY')

paulyeo11
Master
Master
Author

image of the date.png

paulyeo11
Master
Master
Author

Hi Surendra,

Thank you for your help.

Your no error , not display any value.

Paul Yeo

Anil_Babu_Samineni

Your format is MM-DD-YYYY, Right? Perhaps this?

Year(Date#([Expected Close Date], 'MM-DD-YYYY')) as Year

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)