Skip to Content
avatar image
Former Member

Default date format

Hi,

I want to get default date format for user.

I want to convert a text for example '01.01.2008' to default date format (YYYYMMJJ or JJMMYYYY in depend of user).

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

11 Answers

  • avatar image
    Former Member
    Sep 01, 2008 at 09:33 AM

    Hi,

    Use the FM

    CONVERT_DATE_TO_INTERN_FORMAT

    Regards

    Lekha

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 09:40 AM

    select the DATFM from USR01 table where bname = username.

    data element is XUDATFM for datfm .select the fixed value from data element and choose the date format

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 09:41 AM

    CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

    EXPORTING

    DATUM = '12.02.2001'

    DTYPE = 'DATS'

    • IMPORTING

    • ERROR =

    IDATE = lv_date

    • MESSG =

    • MSGLN =

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 09:41 AM

    Hi,

    I hope this will help you,

    HRGPBS_HESA_DATE_FORMAT

    Regards,

    Harish

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 09:42 AM

    Hi,

    Use FM CONVERT_DATE_TO_INTERNAL.

    Regards,

    Raju.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 09:43 AM

    hii

    default format of date is yyyymmdd..so for that you can use FM

    CONVERT_DATE_TO_INTERNAL

    and for ddmmyyyy for mat you can use logic like below

    data:wa_date like sy-datum,

    wa_dt(10) type c.

    Concatenate wa_date +6(2)wa_date +4(2) wa_date +0(4) into wa_dt.

    result = wa_dt

    regards

    twinkal

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 09:45 AM

    HI,

    check with the following FM.

    SLS_MISC_GET_USER_FORMAT

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 01, 2008 at 09:47 AM

    Simo,

    for getting default date from user:

    use FM DATUMSAUFBEREITUNG.

    data: idate TYPE sy-datum,
              tdat8 type string.
     idate              = <your date>
     CALL FUNCTION 'DATUMSAUFBEREITUNG'
         EXPORTING
           IDATE                 = idate
         IMPORTING
            TDAT8                 = tdat8"user's default date formate
        EXCEPTIONS
           DATFM_UNGUELTIG       = 1
           DATUM_UNGUELTIG       = 2
           OTHERS                = 3.

    Amit.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Amit Gujargoud

      My first value is char(10) not date not parameter.

      data: v_data(10).

      v_data = '31.08.2008' for example

      My question is how can i do for converting this value on default date format for user?

  • avatar image
    Former Member
    Sep 01, 2008 at 10:06 AM

    hi,

    data: wa type string.

    data: w_date type string.

    wa = '01.11.2008'.

    data:wa_year type char4.

    data: wa_month type char2.

    data: wa_date type char2.

    replace all occurrences of '.' in wa with space.

    wa_year = wa+4(4).

    wa_month = wa+2(2).

    wa_date = wa+0(2).

    concatenate wa_year wa_month wa_date into w_date.

    Write:/ w_date.

    This will exaclty print your desired output.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 11:36 AM

    Hi,

    for this you can directly move the value of type sy-datum to type d and pass the value.

    DATA:
      w_date TYPE d.
      w_date = sy-datum. " move value
      write: w_date.

    Regards

    Adil

    Add comment
    10|10000 characters needed characters exceeded