Skip to Content

isDate() Function

Hi

I have a string that contains date as '10.10.2005'. Now how do i confirm if the string is a date. In short i need to achieve isDate () functionality like in other languages.

Can i try using

SEARCH <String> FOR '*.2005'.

Or is there any better way of using FM to achieve this.

Suggestion regarding this are welcome !!!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2005 at 05:11 AM

    Hi again,

    1. i tried ur query again, but its working FINE.

    2. try this FM

    CONVERT_DATE_TO_INTERN_FORMAT

    3. if u give : 10.10.2005 --- OK

    2345 --- invalid date

    20051010 --- OK

    31.11.2005 --- invalid date (november does not have 31 days)

    4. I think this is what is required (if

    im wrong, pls let me know)

    5. This FM will take care of all date formats

    whether : dd.mm.yyyy or YYYYMMDD.

    6. The pervious PLAUSIBLE function module

    has contraint (as i had already mentioned)

    of date input in YYYYMMDD format.

    Hope it helps.

    regards,

    amit m.

    Message was edited by: Amit Mittal

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2005 at 04:27 AM

    Murali,

    You should be able to use the function DATE_CHECK_PLAUSIBILITY for this purpose.

    Regards,

    Ravi

    Note : Please reward points if this helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2005 at 04:34 AM

    Hi Muralidaran,

    1. One way is using FM

    DATE_CHECK_PLAUSIBILITY

    2. Only one constraint is that it expects

    the date in YYYYMMDD format.

    3. Mean while im searching for ur exact requirement.

    Hope it helps.

    Regards,

    Amit M.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2005 at 04:44 AM

    Hi Again,

    THIS NEW FUNCTION DOES NOT HAVE PROBLEM

    OF DATE FORMAT

    AS THE FM DATE_CHECK_PLAUSIBILITY

    MENTIONED IN MY PREVIOUS POST.

    1. Got another FM

    CONVERT_DATE_TO_INTERN_FORMAT

    2. Try this code (Just copy paste)

    REPORT abc NO STANDARD PAGE HEADING.

    data : s(10) type c.

    s = '3.11.2005.'.

    data : err type c.

    *----


    CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

    EXPORTING

    datum = s

    dtype = 'DATS'

    IMPORTING

    ERROR = err

    • IDATE =

    • MESSG =

    • MSGLN =

    .

    *----


    write :/ err.

    BREAK-POINT.

    Hope it helps.

    Regards,

    Amit M.

    Message was edited by: Amit Mittal

    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.