‎2007 Sep 24 11:50 AM
Hi everyone,
I want to convert an internal date i.e. 20070924 to SEP2007 (YYYYMMDD) to
MMMDD and was wondering if there is a FM to do this. I have searched
but can't find anything suitable.
I know I could write a bit of code myself to do this but thought a FM would be
better.
thanks
Andy
‎2007 Sep 24 11:55 AM
you can try this
PARAMETERS : P_DATE LIKE SY-DATUM.
DATA : res(30).
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
INPUT = p_date
IMPORTING
OUTPUT = res
.
write : / res+2.
regards
shiba dutta
‎2007 Sep 24 11:53 AM
HI Scott,
Try this,
DATE_CONV_EXT_TO_INT
Check this sample code,
DATE_CONV_EXT_TO_INT - user formatted date is converted to system date
data: date_intern type d,
date_extern(10).
date_extern = 28.03.2000.
CALL DATE_CONV_EXT_TO_INT ID DATINT FIELD date_intern Intern Date ID DATEXT FIELD date_extern. Extern Date
Now the field date_intern will have the value 20000328.
Check the sy-subrc for possible wrong input.
CONVERT_DATE_TO_EXTERNAL - Converts date from system storage format to users specified display format
REPORT ZHAR_1 .
data l_date(10).
data l_datum type sy-datum.
l_datum = '20050815'.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = l_DATUM
IMPORTING
DATE_EXTERNAL = l_date
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write: /1 l_date.
Thanks,
Reward If Helpful.
‎2007 Sep 24 11:53 AM
HI,
USE FM CONVERSION_EXIT_SDATE_OUTPUT for this format 05DEC2006
OR FM - DATE
Reward points if this helps.
Manish <b></b>
‎2007 Sep 24 11:54 AM
‎2007 Sep 24 11:55 AM
you can try this
PARAMETERS : P_DATE LIKE SY-DATUM.
DATA : res(30).
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
INPUT = p_date
IMPORTING
OUTPUT = res
.
write : / res+2.
regards
shiba dutta
‎2007 Sep 24 12:00 PM
‎2007 Sep 24 11:57 AM
Andy,
These are some date related function modules which I came across.Hope these can give you some lead.
DATE_COMPUTE_DAY - Finds day of the month
DATE_CONV_EXT_TO_INT - user formatted date is converted to system date
DATE_GET_WEEK - convert date into year + week format
DATE_TO_DAY - gives weekday from date
DATE_IN_FUTURE - takes number of days and date - gives future date in user format and system format
MONTH_NAMES_GET - language is only parameter. Returns internal table with months.
MONTH_PLUS_DETERMINE -subtract months from date
WEEK_GET_FIRST_DAY - take input as YYYYWW and it gives first day of the week.
CONVERSION_EXIT_SDATE_OUTPUT-changes the date format as 31 Aug 2007 if given as 31/08/2007.
K.Kiran.
‎2007 Sep 24 11:59 AM
HI..
This is the Code:
REPORT ZSEL_DATE_CON1.
data: v_date1 type d VALUE '20070110'.
dATA : V_DATE2(6).
CONCATENATE V_DATE1+4(2) V_DATE1(4) INTO V_dATE2.
WRITE: V_dATE2.
<b>REWARD IF hELPFUL.</b>