‎2009 Apr 01 2:02 PM
Hi Experts,
Is there any FM to Convert the date from 04/01/2009 to 4/1/2009?
i want to remove the zero before the date and month.
Regards.
‎2009 Apr 01 2:35 PM
Hi,
Test the following Sample Code it will solve out your problem,
PARAMETERS: date like sy-datum.
data: day(2),
month(2),
year(4),
cdate(10).
day = date+6(2).
month = date+4(2).
year = date+0(4).
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = day
IMPORTING
OUTPUT = day
.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = month
IMPORTING
OUTPUT = month
.
CONCATENATE: day '/' month '/' year into cdate.
WRITE: cdate.Best Regards,
Faisal
‎2009 Apr 01 2:35 PM
Hi,
Test the following Sample Code it will solve out your problem,
PARAMETERS: date like sy-datum.
data: day(2),
month(2),
year(4),
cdate(10).
day = date+6(2).
month = date+4(2).
year = date+0(4).
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = day
IMPORTING
OUTPUT = day
.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = month
IMPORTING
OUTPUT = month
.
CONCATENATE: day '/' month '/' year into cdate.
WRITE: cdate.Best Regards,
Faisal
‎2009 Apr 01 2:35 PM
HI,
DATA : wa_date(10) VALUE '04/01/2009',
wa_mnt(2),
wa_dt(2),
wa_year(4).
SPLIT wa_date AT '/' INTO wa_mnt
wa_dt
wa_year.
CONCATENATE wa_mnt+1(1) wa_dt+1(1) wa_year INTO wa_date SEPARATED BY '/'.
BREAK-POINT.Thanks & Regards
‎2009 Apr 01 2:39 PM
Sorry, Always Learner
Your code can create problem for date like 24.12.2008 it will show it 4/2/2008
Best Regards,
Faisal
‎2009 Apr 01 2:41 PM
yes..u r right..
i gave the solution as per the thread
converting date from 04/01/2009 to 4/1/2009
To convert in above format my code works fine
‎2009 Apr 01 2:49 PM
Is there any FM to Convert the date from 04/01/2009 to 4/1/2009?
i want to remove the zero before the date and month.
data:lv_date(10) type c,
lv_day(2) type c,
lv_month(2) type c,
lv_year(4) type c.
lv_date = '04/01/2009'.
lv_year = lv_date+6(4).
lv_day = lv_date+0(2).
lv_month = lv_date+3(2).
if lv_day(1) = '0'.
lv_day = lv_day+1(1).
endif.
if lv_month(1) = '0'.
lv_month = lv_month+1(1).
endif.
concatenate
lv_day
lv_month
lv_year
into lv_date
separated by '/'.
write: lv_date.