Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted

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

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

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

22 Replies
Highlighted

try like this

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

Highlighted
Master
Master

Hi Avinash

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

Error in expression:

SUBFILED is not a valid function


Paul

Highlighted

I would think this?

Year([Expected Close Date]) as Year

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)
Highlighted
Master
Master

Hi Anil

Thank you for your sharing again.

Your no error but not display any value.

Paul

Highlighted

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

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)
Highlighted
Specialist
Specialist

Try

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

Highlighted
Master
Master

image of the date.png

Highlighted
Master
Master

Hi Surendra,

Thank you for your help.

Your no error , not display any value.

Paul Yeo

Highlighted

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

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

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