cancel
Showing results for 
Search instead for 
Did you mean: 

HANA date format

Former Member
0 Kudos

     Hello Gurus,

I need some help on below issue in HANA modeler-

I have date in 2015-10-09 stored in table. I want to convert to YYYYMMDD format in table. The date is stored  as  sql type "'nvarchar" 10 string.

Please suggest the best approach. this is one time activity.

Thanks

Pallavi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Pallavi,

Since the data in the table is of NVARCHAR datatype, the TO_CHAR function would fail.

It issue can be resolved in the below following way:

create table date_test(col1 nvarchar(10));

insert into date_test values('2015-10-09');

select to_char(to_date(col1, 'YYYY-MM-DD'), 'YYYYMMDD')

from date_test;

You need to use to_char(to_date(col1, 'YYYY-MM-DD'), 'YYYYMMDD')

Regards,

Anil

Former Member
0 Kudos

Hello Pallavi,

Use TO_CHAR(DATE,8)

select to_char(date,8) from "schema_name"."Table_name" ;