Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
davidmoises
Partner - Contributor II
Partner - Contributor II

Problem dealing with dates

Hello

I run into a little problem dealing with dates. I leave below a table in which you can see the date field
I'm trying and some of the tests I've already done.

clipboard_image_2.png

The field in question is the first to appear in the table and, as you can see, has a date in 'YYYYMMDD' format.

What I have to achieve is to keep only the year, eliminating the part corresponding to the month and day. In columns 2,3,4,5 you can see some tests I have done.

I know that I could get the same result simply by running a left, as shown below, but I would like to know the reason why I can not do it in the way mentioned above, using date() and above all understand the reason why this date appears so strange numeric.

clipboard_image_1.png

Thanks to all

 

Labels (2)
1 Solution

Accepted Solutions
martinpohl
Partner - Master
Partner - Master

the date format YYYYMMDD (SAP standard format) is one which cannot verify correctly without scripting

use

year(date#(ERDAT,'YYYYMMDD')) as Year,

date(date#(ERDAT,'YYYYMMDD')) as date

and so on

View solution in original post

2 Replies
martinpohl
Partner - Master
Partner - Master

the date format YYYYMMDD (SAP standard format) is one which cannot verify correctly without scripting

use

year(date#(ERDAT,'YYYYMMDD')) as Year,

date(date#(ERDAT,'YYYYMMDD')) as date

and so on

davidmoises
Partner - Contributor II
Partner - Contributor II
Author

It worked perfectly, thank you very much for the explanation. Greetings