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

Date format problem

Hello,

we have the following problem. We have an inputField connected to a context attribute with the date type. When you use the datepicker, and when default dates are shown, the date is in the format DD.MM.YYYY (which is the correct format for our locale).

However, the user can also enter a date without using the datepicker. When he/she enters a date in the format DD-MM-YYYY, SAP automatically thinks this is a date in a different locale, and switches the DD values with the MM values. So, in reality, when a user enters the date with '-', SAP turns it into MM.DD.YYYY. How can I make sure that doesn't happen? I only want the user to be able to enter in DD.MM.YYYY, or not enter anything at all, and only use the datepicker.

To give you specific examples: The correct date would be 12.06.2008 (12th of june 2008). When a user enters 12-06-2008 SAP changes the date to 06.12.2008 (6th of december 2008).

Gr,

Jaron

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 26, 2008 at 07:36 AM

    Hi,

    have you checked [this documentation|http://help.sap.com/saphelp_nw70/helpdata/en/46/f7bb3bde4369b5e10000000a114a6b/content.htm] for information on the different time formats?

    Regards, Heidi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 26, 2008 at 11:27 AM

    Hi Frenk,

    If the user is accessing WebDynpro application from portal then change in user admin of the portal change language from english US to english UK. In english UK date format is dd.mm.yyyy

    If user has corresponding ECC login (generally in case of ESS)

    then from user admin at ECC changes its default date format using transaction SU01

    Thanks

    Sameer

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 26, 2008 at 01:42 PM

    Well I assume that the problem is with the fact that DD-MM-YYYY is not a date format supported by ABAP. We have DD.MM.YYYY, MM/DD/YYYY, MM-DD-YYYY. Therefore there is no way for ABAP to differentiate between DD-MM-YYYY and MM-DD-YYYY - hence the situation you have occuring.

    You could beat your end users into submission to get them to use the "correct" date format. Short of floggings, a programatic approach might be to create your own custom Date domain in the ABAP Data Dictionary. This would still be a date data type, but you can supply a custom Conversion Routine.

    [http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21ee19446011d189700000e8322d00/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21ee19446011d189700000e8322d00/frameset.htm]

    That is kind of drastic and will require some effort on your part - but it should be possible. Personally I prefer the idea of just torturing the end users. 😊

    Add a comment
    10|10000 characters needed characters exceeded

    • >

      > Yes.. I am sorry. I have mixed up with something else. it should be yyyy-mm-dd.

      >

      > regards

      > Satrajit.

      No the internal format isn't yyyy-mm-dd, it is as I said yyyymmdd. That's a pretty important distinction when you are telling someone to manually parse the data themselves from the internal format. Dates are stored as char 8 with no separation between the data segments.

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.