cancel
Showing results for 
Search instead for 
Did you mean: 

Date conversion

Former Member
0 Kudos

Hi Experts,

I have a variable(gv_date) in which i get date in the following format

20.12.2007.

But i need to get it printed in the

20 December 2007

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi karthick,

Check this code.It might be of use.

DATA: v_date TYPE string.

CASE p_date+4(2).

WHEN 01.

CONCATENATE 'January' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 02.

CONCATENATE 'Febuary' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 03.

CONCATENATE 'March' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 04.

CONCATENATE 'April' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 05.

CONCATENATE 'May' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 06.

CONCATENATE 'June' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 07.

CONCATENATE 'July' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 08.

CONCATENATE 'August' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 09.

CONCATENATE 'September' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 10.

CONCATENATE 'October' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 11.

CONCATENATE 'November' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 12.

CONCATENATE 'December' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

ENDCASE.

WRITE:/ v_date.

Or else check this code:

DATA V_MONTH(11).

CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'

EXPORTING

INPUT = SY-DATUM

IMPORTING

OUTPUT = V_MONTH.

WRITE:/ 'CURRENT MONTH IN WORDS:', V_MONTH+3(8).[/code]

Reward if useful

thanks

swaroop

Former Member
0 Kudos

Hi karthick,

Check this code.It might be of use.

DATA: v_date TYPE string.

CASE p_date+4(2).

WHEN 01.

CONCATENATE 'January' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 02.

CONCATENATE 'Febuary' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 03.

CONCATENATE 'March' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 04.

CONCATENATE 'April' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 05.

CONCATENATE 'May' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 06.

CONCATENATE 'June' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 07.

CONCATENATE 'July' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 08.

CONCATENATE 'August' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 09.

CONCATENATE 'September' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 10.

CONCATENATE 'October' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 11.

CONCATENATE 'November' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

WHEN 12.

CONCATENATE 'December' p_date+6(2) 'th,' p_date(4)

INTO v_date SEPARATED BY space.

ENDCASE.

WRITE:/ v_date.

Or else check this code:

DATA V_MONTH(11).

CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'

EXPORTING

INPUT = SY-DATUM

IMPORTING

OUTPUT = V_MONTH.

WRITE:/ 'CURRENT MONTH IN WORDS:', V_MONTH+3(8).[/code]

Reward if usefull.

Regards,

Kashyap Ivaturi

Edited by: Kashyap Ivaturi on Jan 11, 2008 11:37 AM

Former Member
0 Kudos

Hi,

The language dependent names of the months are stored in table T015M, so you'll need to write some ABAP to take the month part of your date and the logon language to read the table. Then combine that with the day and year into a new variable.

As you don't say whether you're using SAPscript, Smartforms or Adobe forms I can't be more specific.

Regards,

Nick