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

Former Member
0 Likes
709

Hi friends,

My date field format is '20070418'.

I need to declare my date field in this format '18042007'can any one tell me how to declare it.

Regards,

Line

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
661

Hi ,

DATA : date(10) VALUE '00/00/0000'.

PERFORM date_conv USING itdate CHANGING date.

FORM date_conv USING date CHANGING date1.

MOVE date0(4) TO date16(4).

MOVE date4(2) TO date13(2).

MOVE date6(2) TO date10(2).

ENDFORM.

You can remove the speartors / if you dont want.

Regards,

Irfan

Note: Reward useful answers.

5 REPLIES 5
Read only

Former Member
0 Likes
661

hi Line,

you can use the function CONVERSION_EXIT_PDATE_OUTPUT to convert the date from YYYYMMDD to DDMMYYYY.

Tell me if you need and example,

Regards,

Roxana

Read only

Former Member
0 Likes
661

Hi,

You can use concatenate to get it in the format..

DATA: V_INPUT TYPE SYDATUM.

DATA: V_OUTPUT(8).

V_INPUT = SY-DATUM.

CONCATENATE V_INPUT6(2) V_INPUT4(2) V_INPUT(4) INTO V_OUTPUT.

WRITE: / v_output.

Thanks,

Naren

Read only

Former Member
0 Likes
661

hi

good

try with this function module

RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date

otherwise store the current date value into a character string and than change the format and store in another character string and print that new character string.

thanks

mrutyun^

Read only

Former Member
0 Likes
662

Hi ,

DATA : date(10) VALUE '00/00/0000'.

PERFORM date_conv USING itdate CHANGING date.

FORM date_conv USING date CHANGING date1.

MOVE date0(4) TO date16(4).

MOVE date4(2) TO date13(2).

MOVE date6(2) TO date10(2).

ENDFORM.

You can remove the speartors / if you dont want.

Regards,

Irfan

Note: Reward useful answers.

Read only

sharadendu_agrawal
Active Participant
0 Likes
661

In this code you can interchange the location of the year,day and month fields as required.

DATA: date LIKE sy-datum,

changedate(10) TYPE c.

DATA: BEGIN OF it_date1, " To accept date into a internal table

yyyy(4),

mm(2),

dd(2),

END OF it_date1.

DATA: BEGIN OF it_date2, " Internal table for dd/mm/yyyy format

dd(2),

mm(2),

yyyy(4),

END OF it_date2.

DATA: BEGIN OF it_date3, " Internal table for mm/dd/yyyy format

mm(2),

dd(2),

yyyy(4),

END OF it_date3.

date = sy-datum.

it_date1 = date.

MOVE-CORRESPONDING it_date1 TO: it_date2,it_date3.

WRITE it_date2 TO changedate USING EDIT MASK '__/__/____'. " dd/mm/yyyy

WRITE:/ 'Date in dd/mm/yyyy format',

/ changedate.

SKIP.

CLEAR changedate.

WRITE it_date3 TO changedate USING EDIT MASK '__/__/____'. " mm/dd/yyyy

WRITE:/ 'Date in mm/dd/yyyy format',

/ changedate.

Reward if useful