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 Conversions

Former Member
0 Likes
953

Dear All,

I badly need help in Date conversions. I am getting the date in the format say

22122007 (DDMMYYYY) can you help me in converting this to 22.12.2007 (DD.MM.YYYY).

Any help in this regard would be very very helpful.

Thanks a Lot In Advance,

Vinay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
929

DATA TIME TYPE T VALUE '154633'.

WRITE (8) TIME USING EDIT MASK '__:__:__'. "Output: 15:46:33

Regards

prabhu

8 REPLIES 8
Read only

Former Member
0 Likes
929
data : v_date1(8) value '22122007',
         v_date2(10).

concatenate v_date1+0(2) v_date1+2(2) v_date1+4(4) into v_date2 separated by '.'.

write : v_date2.
Read only

ashok_kumar24
Contributor
0 Likes
929

Hi Vinay

<b>Converting dates</b>

<b>DATE_CONV_EXT_TO_INT Conversion of dates to SAP internal format e.g. '28.03.2000' -> 20000328 Can also be used to check if a date is valid ( sy-subrc <> 0 )</b>

Good Luck and thanks

AK

Read only

Former Member
0 Likes
929

data : dt(10) value '22032007'.

write : / dt using edit mask '__.__.____'.

regards

shiba dutta

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
929

Hi

data: g_date(10) type c.

g-date = sy-datum.

CONCATENATE g_date6(2) '.' g_date4(2) '.' g_date+0(4) INTO g_date.

Regards,

Sreeram

Read only

Former Member
0 Likes
929

hi,

take variables V1, V2, V3.

V1 = date+0(4).

V2 = date+4(2) or 5(2). Check it

V3 = date+6(2) or 7(2). check it.

Concatenate V3 V2 V1 into date separated by '.'

Now, date will have DD.MM.YYYY

Regards

Reshma

Read only

Former Member
0 Likes
930

DATA TIME TYPE T VALUE '154633'.

WRITE (8) TIME USING EDIT MASK '__:__:__'. "Output: 15:46:33

Regards

prabhu

Read only

Former Member
0 Likes
929

Hi

Try like this

DATA: v_date type d.

v_date = '22122007'.

write:/(10) v_date using edit mask '__.__.____'.

Regards

Haritha.

Read only

0 Likes
929

Hi.

Very simple, always works, and uses the user definitions.

Write your source field (dats) to a target char(10) field like this:

WRITE: source to target DD/MM/YYYY.

Hope this helps.

Reward helpfull ideas.

Best regards.

Valter Oliveira.