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

Date Format 12th-Mar-2006

Former Member
0 Likes
650

Hi

I have a problem in displaying the date in this format of '12<b>th</b>-Mar-2006' .

can any one tell me is there any function modele for this type..

eg:

12-03-2007 it should be print like - 12<b>th</b>-MAR-2007

22-03-2007 it should be print like - 22<b>nd</b>-MAR-2007

Thanks & Regards

Purshoth

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
619

Hi Purshothaman,

Use FM "MONTH_NAMES_GET" to get the month names. Check the month number with in the returned internal table and concatenate the date and the year to get the desired result.

Regards,

George

    • plz reward points to helpful tips

4 REPLIES 4
Read only

anversha_s
Active Contributor
0 Likes
619

hi,

chk this.

DATA: DATE_CHAR(20).
DATA: DATE TYPE SY-DATUM.
DATA: MONTH_NAME LIKE T247-LTX.

DATE = SY-DATUM.

SELECT SINGLE LTX FROM T247
INTO MONTH_NAME
WHERE SPRAS = SY-LANGU
AND MNR = SY-DATUM+4(2).


CONCATENATE SY-DATUM+6(2) MONTH_NAME SY-DATUM(4)
INTO DATE_CHAR SEPARATED BY SPACE.

WRITE: / DATE_CHAR.

Thanks,

Anver

Read only

Former Member
0 Likes
619
REPORT YCHATEST LINE-SIZE 350.
 
TABLES : T247.
 
DATA : V_DATE LIKE SY-DATUM,
V_DATE_FULL(09),
V_MONTH(25),
V_FINAL(45).
 
V_DATE = SY-DATUM.
 
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
     EXPORTING
          INPUT  = V_DATE
     IMPORTING
          OUTPUT = V_DATE_FULL.
 
 
SELECT SINGLE LTX FROM T247 INTO V_MONTH WHERE KTX EQ V_DATE_FULL+2(3)
AND SPRAS = 'E'.
 
IF V_DATE_FULL+0(2) = '01' OR V_DATE_FULL+0(2) = '31'.
  CONCATENATE V_DATE_FULL+0(2) 'ST' INTO V_FINAL.
ELSEIF V_DATE_FULL+0(2) = '02' OR V_DATE_FULL+0(2) = '22'.
  CONCATENATE V_DATE_FULL+0(2) 'ND' INTO V_FINAL.
ELSEIF V_DATE_FULL+0(2) = '03' OR V_DATE_FULL+0(2) = '23'.
  CONCATENATE V_DATE_FULL+0(2) 'RD' INTO V_FINAL.
ELSE.
  CONCATENATE V_DATE_FULL+0(2) 'TH' INTO V_FINAL.
ENDIF.
 
CONCATENATE V_FINAL V_MONTH INTO V_FINAL SEPARATED BY SPACE.
CONCATENATE V_FINAL V_DATE_FULL+5(4) INTO V_FINAL SEPARATED BY ','.
 
 
WRITE : / V_FINAL.
Read only

0 Likes
619

hi Chandra,

Good Answer. It will work perfectly.

Regards,

Anver

Read only

Former Member
0 Likes
620

Hi Purshothaman,

Use FM "MONTH_NAMES_GET" to get the month names. Check the month number with in the returned internal table and concatenate the date and the year to get the desired result.

Regards,

George

    • plz reward points to helpful tips