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 Conversion

Former Member
0 Likes
688

Hi all,

I would like to get a Function module which returns date, month and year into separate paramaters taking date as input.

Kindly help me out.

Thanks

Arunkumar S

5 REPLIES 5
Read only

suresh_datti
Active Contributor
0 Likes
663

Try CACS_DATE_GET_YEAR_MONTH

~Suresh

Read only

Former Member
0 Likes
663

lv_datum like sy-datum

write date to lv_datum

year =lv_datum+0(4)

month = lv_datum+5(2)

day= lv_datum+7(2)

my offset might be wrong... just check

Read only

abdul_hakim
Active Contributor
0 Likes
663

hi

you can do it manually using offset validations.

suppose you have the date in the format yyyymmdd.

then you can split as follows..

data: dat1 like mara-laeda value '20060822',

year(4),

month(2),

day(2).

year = dat1+0(4).

month = dat13(2).

day = dat1+5(2).

Cheers,

Abdul Hakim

Read only

Former Member
0 Likes
663

Hai

parameters : p_date(8) default '20061025'.

data : v_out type sy-datum.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

DATE_EXTERNAL = p_date

IMPORTING

DATE_INTERNAL = v_out.

write 😕 v_out.

Regards

Sreeni

Read only

Former Member
0 Likes
663

if your date format is in YYYYMMDD,

you can use OFFSET to get the values seperately

V_DATE = '20060102'.

v_year = v_date+0(4).

V_month = V_DATE+4(2).

V_days = V_DATE+6(2).

Regards

srikanth