cancel
Showing results for 
Search instead for 
Did you mean: 

Date format in HANA Stored procedure

hemanth_kumar21
Contributor
0 Kudos
492

Hi Experts,

I would like to change the format from 'YYYY-MM-DD HH24:MI:SS.FF7' to 'DD.MM.YYYY' format. ( Because my target will accept only this format )

How to do the same? do we have any standard functions which it converts to mentioned format.

Like in ABAP, CONVERSION_EXIT_IDATE_INPUT/OUTPUT.

I tried with Splitting the date and concatenating into required format. But, just want know if we have any standard function.

View Entire Topic
Michał
Advisor
Advisor
0 Kudos

Hi Modadugu,

you should be able to achieve that with TO_VARCHAR conversion function.

Regards,

Michal

hemanth_kumar21
Contributor
0 Kudos

Hi Michal,

Thanks for your reply.

I am trying with the below query

declare is_valid varchar (12);

SELECT TO_CHAR(TO_DATE(valid_until), 'DD.MM.YYYY')

   INTO   IS_VALID

   FROM  USERS

   WHERE "USER_NAME" =  'test';

while using is_valid in the insert query i got an error.

Error while parsing IS_VALID as TIMESTAMP

what is the data type for IS_VALID should be?

hemanth_kumar21
Contributor
0 Kudos

Got it... Problem is with the Data type for IS_VALID, should be declare as varchar(10)