Application Development and Automation 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: 
Read only

changing the date format

Former Member
0 Likes
517

How do i create a function module that imports date in a system format and displays the output in the following format:

Input date : 12/31/9999

Output date: 31st December 9999

3 REPLIES 3
Read only

Former Member
0 Likes
494

Hi,

Try this,

Use FM ISP_GET_MONTH_NAME and the values to it like this and use concatanate to the same

Import parameters Value

DATE 20.02.2007

LANGUAGE EN

MONTH_NUMBER 00

Export parameters Value

LANGU_BACK EN

LONGTEXT February

SHORTTEXT FEB

Thanks.

Read only

Former Member
0 Likes
494

Hi,

date3 EQ 'X'. "The date format is like 31 apr, 2007

CONDENSE temp_date NO-GAPS.

SPLIT i_date AT ',' INTO daymonth year.

IF STRLEN( year ) NE '4'.

error = 'X'.

WRITE : 'Invalid date format.'.

ELSE.

daymonth1 = daymonth.

CONDENSE daymonth1 NO-GAPS.

SHIFT daymonth1 LEFT BY 2 PLACES.

CONDENSE daymonth1 NO-GAPS.

month = daymonth1.

CONDENSE month NO-GAPS.

TRANSLATE month TO UPPER CASE.

SORT t_month BY monthstx.

MOVE month to mon.

READ TABLE t_month WITH KEY monthstx = mon.

IF sy-subrc <> 0.

error = 'X'.

WRITE : 'Invalid date format.' .

ELSE.

CONDENSE daymonth NO-GAPS.

day = daymonth+0(2).

CONDENSE day NO-GAPS.

CONCATENATE year t_month-monthnumber day INTO o_date.

ENDIF.

<b>Reward points</b>

Regards

Read only

Former Member
0 Likes
494

Hi,

You may use FM DAY_ATTRIBUTES_GET with input date in dd.mm.yyyy format.

So you first need to convert the date from mm/dd/yyy to format dd.mm.yyyy by using the string operations & then use the above mentioned FM.

I hope this helps,

Regards,

Raju Chitale