Skip to Content
0
Former Member
Mar 17, 2014 at 12:38 PM

How to convert a timestamp to date/time in CDS View?

15985 Views

Dear experts,

I would like to convert a timestamp to a date and time within a CDS view.

This is what I tried to do:

Cast (Cast(<timestamp> as abap.dec(8,0)) as abap.dats) as <date>

I also thought about first converting the timestamp into a plain numerical character, then using substring and then casting it to abap.dats. Then its giving me an error that says: "dec can't be converted into numc".

The above written code also throws an error - "function not allowed/ no cast within a cast".

It is quite nasty not being able to write a cast within a cast - how else am i supposed to achieve a date here?

I am looking forward to have your answers!

Thanks and BR

Anja