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: 

Date Conversion

Former Member
0 Kudos

Hi All,

I am comapring two date fields.

First is inverted date which i am converting to normal date through FM "CONVERSION_EXIT_INVDT_OUTPUT" and the output is in the format dd/mm/yyyy.

Second date is in format mm/dd/yyyy.

How can I compare these two dates ?

I can't convert these second date fromat, So please advice me on how to convert first date format dd/mm/yyyy to mm/dd/yyyy ?

Thanks,

Sri Arun Prian.

3 REPLIES 3

JozsefSzikszai
Active Contributor
0 Kudos

you have to define two variables with type d (format will be YYYYMMDD) and transform both dates into these variables and make comparison afterwards

Former Member
0 Kudos

No need to convert the first date, leave it as it is;

Do the following with the second date;

data : lv_date2(10) type c value '10/21/2008', "Date 2
         lv_date1 type d value ' 20081020', " Date 1
         lv_date2new type d. " date 2 in default format

lv_date2new(4) = lv_date2+6(4). " copy Year
lv_date2new+4(2) = lv_date2(2). " copy Month
lv_date2new+6(2) = lv_date2+3(2). " Copy Day

Now Check/compare the dates.

For example IF lv_date2new EQ lv_Date1 --- > will return False.

Regards

Karthik D

Former Member
0 Kudos

Hi,

use FM

FORMAT_DATE_4_OUTPUT

 Ex:Import: datin : 20.10.2008 
     and format : MM/DD/YYYY.

output : 10/20/2008

Regards,

Sathish Reddy.