Skip to Content
avatar image
Former Member

remove '.' from date

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    Sep 23, 2008 at 07:21 AM

    hi...

    use replace

    regards

    vivek

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 23, 2008 at 07:24 AM
    REPLACE all occurences of '.' in date_field with ''.
    
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 23, 2008 at 07:24 AM
    DATA: w_var(10) TYPE c.
    w_var = '31.12.2008'.
    
    REPLACE ALL OCCURRENCES OF '.' in w_var WITH '' .
    WRITE / w_var.
    
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 23, 2008 at 07:28 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 23, 2008 at 07:31 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 23, 2008 at 07:34 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 23, 2008 at 07:50 AM
    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 😊

    Add comment
    10|10000 characters needed characters exceeded