Skip to Content

Datevalue function in SAP

May 24, 2017 at 06:02 AM


avatar image

Hi All,

I want to find date value for particular date(ex 01/01/2014 = 41640 as in excel).

Is there any FM in SAP to find date value for a particular date.

Thanks in advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Raymond Giuseppi
May 24, 2017 at 06:27 AM

What's your purpose? Nevertheless just MOVE the date field to an integer field.

(Conversion Rules for Elementary Data Objects → Date/Time Fields as Source Fields → Source Field Type)

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Thanks Raymond. Actually i am trying to find average between 2 dates (between 01.01.2014 & 01.04.2017).



Use the implicit conversion from date to integer like when the Abaper add or subtract some integer to a date.

date3 = date1 + ( date2 - date1 ) / 2 .

What's wrong with SD_DATETIME_DIFFERENCE and in any case what do you mean by 'Average between 2 dates'. The average what ??? If you really want what you state it is 1 day.


Isn't technically a "date" a quantity, the "duration since an initial calendar date", so the average value of two dates can make sense?

Of course expressions like center/middle of range/interval and other ones could have been used ;-)

Actually following syntax is also ok in Abap...

date3 = ( date1 + date2 ) / 2.
Horst Keller
May 24, 2017 at 07:06 AM
Show 4 Share
10 |10000 characters needed characters left characters exceeded

Like electromagnetism (wave/particle ) dates in abap carry some duality (character/numeric)


So what happens when you run a 'Delayed Choice' experiment and turn the detectors on ? Are they then dates or characters or numeric ???


Isn't it more like Schroedinger's Cat? The day just is; it is the act of observation that reveals their format. If observed on a computer, they are numeric. Printed and hanging on a wall they are clearly character-based and not suitable for programmatic calculations.

Then there are also the more specialist date formats such as Lego and Stone, not sure if SAP will support those in future versions, maybe if we petition them enough...?


I studied physics and document ABAP now. That fits.