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: 

remove '.' from date

Former Member
0 Kudos

hi,

i am passing a date field in my program as 23.09.2008, but i want to remove the '.' before process it. can any one advice what is the code to remove '.'? i believe there is but i already forgotten of it. thanks

7 REPLIES 7

Former Member
0 Kudos

hi...

use replace

regards

vivek

rainer_hbenthal
Active Contributor
0 Kudos

REPLACE all occurences of '.' in date_field with ''.

Former Member
0 Kudos

DATA: w_var(10) TYPE c.
w_var = '31.12.2008'.

REPLACE ALL OCCURRENCES OF '.' in w_var WITH '' .
WRITE / w_var.

Former Member
0 Kudos

Hi ben,

Replace will only remove .(dots) and give the date as 23092008 but the internal date format is 20080923.

So use the FM CONVERT_DATE_TO_INTERNAL to convert a date to internal format.

Revert Back if you have doubts.

Regards

Karthik d

bpawanchand
Active Contributor
0 Kudos

hi

DATA :
   w_d TYPE d,
   w_d1 TYPE sy-datum.


w_d1 = sy-datum.

CONCATENATE w_d1+0(4) w_d1+4(2) w_d1+6(2) INTO w_d.

WRITE :
  / w_d.

Regards

Pavan

Former Member
0 Kudos

Hi,

Try like this:

data: fld1(12) type c,

fld2(12) type c,

fld3(2) type c,

fld4(2) type c,

fld5(4) type c.

fld1 = '23.09.2008'.

fld3 = fld1+0(2).

fld4 = fld1+3(2).

fld5 = fld1+6(4).

concatenate fld3 fld4 fld5 into fld2.

write: / fld1,

/ fld2.

Regards,

Bhaskar

former_member181995
Active Contributor
0 Kudos
believe there is but i already forgotten of it

But SDN database is still Active and Up so you need to just search nothing else