Skip to main content
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

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

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

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
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

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
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

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