Skip to Content
author's profile photo Former Member
Former Member

date conversion

i need to convert the date.. want to convert from YYYYMMDD to DD.MM.YYYY

is there any functional module available for that?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

10 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 12:49 PM

    Hi,

    I am not sure that there is any function modules. But use the following code as.

    data : date like sy-datum,

    var(10).

    concatenate date6(2) '.' date4(2) '.' date+0(4) into var.

    write : /1 var.

    Regards,

    Sankar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 12:49 PM

    Hi,

    Try using FM CONVERSION_EXIT_PDATE_OUTPUT.

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 12:51 PM

    Hi,

    Use Write statement using EDIT MASK .you can achieve the result.

    WRITE .... EDIT MASK .....

    ex:

    data : ldate type sy-datum,

    wdate type char10.

    ldate = sy-datum.

    write ldate TO wdate USING EDIT MASK '__.__.____'.

    WRITE : / wdate.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 12:52 PM

    Hi Suresh,

    you have FM's to convert the date in the system format to internal format.

    But you can achieve the same with simple statements.

    data l_date(10) type c.

    concatenate <yourdate_variable>6(2) '.' <yourdate_variable>4(2) '.' <yourdate_variable>+0(4) into l_date.

    then you shall be left with l_date which holds date in your required format.

    Reward points if this helps,

    Kiran

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 12:53 PM

    HI,

    use FM CONVERSION_EXIT_PDATE_OUTPUT

    Regards,

    S.Nehru.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 12:53 PM

    Hi,

    Lets say

    DAT1 is in format YYYYMMDD

    and you want DAT2 should be in DD.MM.YYYY

    You can use concatenate statement like below.

    CONCATENATE DAT16(2) '.' DAT14(2) '.' DAT1+0(4) TO DAT2.

    Regards,

    Mayank

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 12:54 PM

    hi,

    CONVERSION_EXIT_PDATE_OUTPUT

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 12:57 PM

    Data : gv_datum type sy-datum value sy-datum,

    gv_date(10) type c.

    constant : gc_dot type c value '.'.

    concatenate gv_datum6(2) gc_dot gv_datum4(2) gc_dot gv_datum+0(4)

    into gv_date.

    write gv_date.

    Regards

    Sagar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 12:58 PM

    hi use this ...

    parameters: p_dat(10) .

    data: dat1(4),

    dat2(2),

    dat3(2),

    date(10).

    dat1 = p_dat+0(4).

    dat2 = p_dat+4(2).

    dat3 = p_dat+6(2).

    concatenate dat3 dat2 dat1 into date separated by '.'.

    write:/ date.

    regards,

    venkat

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2008 at 01:01 PM

    Instead of FM using one string concatenation u can do the same functionality.

    concatenate date6(2) '.' date4(2) '.' date(4) into date1

    Reward pts for useful answers.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.