Skip to Content

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 24 at 07:56 AM

    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)

    datatype.png (1.6 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 24 at 07:55 AM

    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'))
    Add comment
    10|10000 characters needed characters exceeded