‎2007 Apr 10 7:47 AM
i need to change the date format rom ddmmyyyy to yyyymmdd. i know this can be done using edit mask. but i don't know the syntax for this , could any one plz.
‎2007 Apr 10 7:50 AM
hi sunil,
1. we can take another variable and using offset concept we can do that.
2. concatenate mydate4(4) mydate2(2) mydate(2)
into newdate.
‎2007 Apr 10 7:51 AM
‎2007 Apr 10 7:52 AM
Hi,
In SAP all the dates are stored in the format YYYYMMDD only.
if you are getting that field from somewhere just keep as it is:
if you wants from ddmmyyyy to yyyymmdd:
data: date(8), date1(8), mon(2),day(2),year(4).
date = ddmmyyyy
year = date+4(4).
mon = date+2(2)
day = date+0(2).
concatenate year mon day into date1.
reward if useful
regards,
ANJI
‎2007 Apr 10 7:52 AM
Hi Sunil,
Hope this code helps you.
data mydate like sy-datum.
data: year(4) type c,
month(2) type c,
date(2) type c.
year = mydate(4).
month = mydate+4(2).
date = mydate+6(2).
write: / year no-gap, month no-gap, date.
reward if helpful.
Regards,
Thasneem
‎2007 Apr 10 7:53 AM
Hi,
You can use the below syntax for this one
concatenate mydate4(4) mydate2(2) mydate(2)
Even you can use the Function module <b>CONVERT_DATE_TO_INTERNAL</b> to convert the internal format.
Regards
Sudheer
‎2007 Apr 10 7:54 AM
fromdate4(4) = sy-datum0(4).
fromdate+2(2) = write month.
fromdate+0(2) = write days
‎2007 Apr 10 7:54 AM
sunil,
Here s_date is your date input field.
concatenate s_date4(4) s_date2(2) s_date+0(2) into s_date.
Don't forget to reward if useful...
‎2007 Apr 10 7:55 AM
WRITE /(30) sy-datum USING EDIT MASK
'RRThe duration is ____/__/__'.
Here are some of available options..
... DD/MM/YY | MM/DD/YY
| DD/MM/YYYY | MM/DD/YYYY
| DDMMYY | MMDDYY | YYMMDD
Reward if helpful...
‎2007 Apr 10 7:56 AM
Hi Sunil,
Check with this please...
data : m like sy-datum..
write sy-datum to m using edit mask '__ __ __'.
write m.
Hope this helps you, reply for queries, Shall post you the updates.
Regards.
Kumar
‎2007 Apr 10 8:00 AM
hi,
chk this.
data : v_date1(10) value '23/02/2007',
v_date(8).
concatenate v_date1+6(4) v_date1+3(2) v_date1+0(2) into v_date.
OR
data : v_date1 TYPE KCDE_INTERN_VALUE,
v_date2 TYPE KCDE_INTERN_VALUE.
CALL FUNCTION 'KCD_EXCEL_DATE_CONVERT'
EXPORTING
EXCEL_DATE = v_date1
DATE_FORMAT = 'TMJ'
IMPORTING
SAP_DATE = v_date2
EXCEPTIONS
OTHERS = 0.Regds
Anversha
‎2007 Apr 10 8:02 AM
hi,
Dont have any edit mask to write in format yyyymmdd.But we have format yymmdd Here is syntax for that edit mask.
WRITE: sy-datum, / sy-datum yymmdd.
regards,
veeresh
‎2007 Apr 10 8:05 AM
Hi
But the complete year is not coming, as its coming 07 but i need 2007
‎2007 Apr 10 8:08 AM
Hi..,
u can write it as ..
sorry..
try this.. its working..
<b>WRITE: sy-datum, / sy-datum using edit mask '____.__.__'.</b>
or use this .. to eliminate the separators also..
<b>WRITE: sy-datum, / sy-datum using edit mask '________'.</b>
reward all helpful answers ..
sai ramesh
‎2007 Apr 10 8:14 AM
Hi Sunil,
Check this info.
Use function module CONVERT_DATE_TO_EXTERNAL. This will convert the date to the user specific format. So if your user specific format is mm/dd/yyyy, then this is all you need.
Hope this resolves your query.
Reward all the helpful answers.
Regards