cancel
Showing results for 
Search instead for 
Did you mean: 

Hana Studio-Calculation Views-Calculated Column Date field to Year.

sspavankumar85
Explorer
0 Kudos

Greetings,

I want to get Year from the date field "BEDGA" or "ENDDA" (having date format as YYYY.MM.DD). I have tried to write calculated column in HANA Studio Calculation View. Please suggest me, how we need to get Year value from below.

Accepted Solutions (1)

Accepted Solutions (1)

KonradZaleski
Active Contributor
0 Kudos

If your column BEGDA is of a DATE type, then your calculation should work. The only thing you need to change is Data Type of that calculated column - currently there is DATE, however YEAR is not a DATE but string:

If BEGDA column is not a DATE type, then try use LEFT function:

LEFT("BEDGA",4)
sspavankumar85
Explorer
0 Kudos

Thank you Konrad Załęski, I have tested, the solution you have given. It's worked. Thank you For your support. Best answer.

Answers (1)

Answers (1)

pfefferf
Active Contributor
0 Kudos

If your date in e.g. column BEGDA is really stored in format 'YYYY.MM.DD', you have to convert it first to a Date format before function YEAR can be applied.

In a SQL engine calculated column you do it like following:

YEAR(TO_DATE("BEGDA",'YYYY.MM.DD'))