Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Datevalue function in SAP

Former Member
0 Kudos

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 REPLIES 10

raymond_giuseppi
Active Contributor

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)

0 Kudos

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

Thanks.

0 Kudos

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 .

0 Kudos

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.

0 Kudos

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.

0 Kudos

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

0 Kudos

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...?

horst_keller
Product and Topic Expert
Product and Topic Expert

I studied physics and document ABAP now. That fits.