Application Development 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: 

Date Conversions

Former Member
0 Kudos

Dear All,

I have some problem in solving the date issues can anyone try to solve this problem,

Actually my input is 20.08.1013.,., i need output in the format of 13.10.2008.. Is there any function module

to convert this..,

Thanks,

Thirukumaran. R

1 ACCEPTED SOLUTION

former_member598013
Active Contributor
0 Kudos

Hi

Try out the below mentioned Funciton Module


CONVERT_DATE_TO_INTERNAL

Thanks,

Chidanand

8 REPLIES 8

bpawanchand
Active Contributor
0 Kudos

Hi

IT is in the format of YYYYMMDD use OFFSET concept and concatenate the offset value to a string and after that pass it to a variable of type SY-DATUM your problem is solved.

example

DATA :

w_d1 TYPE sy-datum,

w_str TYPE string.

w_d2 TYPE sy-datum VALUE '20.08.1013'.

CONCATENATE w_d20(2) w_d23(2) w_d2+6(4) INTO w_str.

now in w_str the value will be '20081013'.

now assign

w_d1 = w_str .

Regards

Pavan

0 Kudos

This message was moderated.

0 Kudos

When i execute the following code the output is '13.10.2081'. date and month are right i need year as 2008.,

Recode my codings.,

constants: date type dats value '20081013'.

data : w_d1 TYPE sy-datum,

w_str TYPE string,

w_d2 TYPE sy-datum VALUE date.

CONCATENATE w_d20(2) w_d23(2) w_d2+4(4) INTO w_str.

w_d1 = w_str .

write : / w_d1.

Thanks,

ThiruKumaran. R

0 Kudos

Hi

constants: date type dats value '20081013'.
data : w_d1 TYPE sy-datum,
w_str TYPE string,
w_d2 TYPE sy-datum VALUE date.
CONCATENATE w_d2+0(2) w_d2+3(2) w_d2+4(4) INTO w_str.
w_d1 = w_str .
write : / w_d1.

CONCATENATE w_d26(2) w_d24(2) w_d2+0(4) INTO w_str.

Now in w_str you will have date as '13102008'.

Regards

Pavan

0 Kudos

Sorry,

my codings is like this,

constants: date type dats value '20.08.1013'.

data : w_d1 TYPE sy-datum,

w_str TYPE string,

w_d2 TYPE sy-datum VALUE date.

CONCATENATE w_d20(2) w_d23(2) w_d2+4(4) INTO w_str.

w_d1 = w_str .

write : / w_d1

Then how to post the message in your format .,.,

Thanks,

Thiru.

Edited by: thirukumaran rajendran on Oct 14, 2008 6:49 AM

former_member598013
Active Contributor
0 Kudos

Hi

Try out the below mentioned Funciton Module


CONVERT_DATE_TO_INTERNAL

Thanks,

Chidanand

Former Member
0 Kudos

Hi.

This code may help u.....


PARAMETERS: p TYPE sy-datum DEFAULT sy-datum.
DATA: d TYPE char10 .

WRITE p TO d MM/DD/YYYY.

Former Member
0 Kudos

Hi thiru,

When ever you want to print the date the format specified just use the following

Data : a type Sy-datum.

Write:a MM/DD/YYYY.

or Write: DD/MM/YYYY.

or write: YYYY/DD/MM.

Use the above write statement according to your convience.

Cheers!!