Input date validation

Sort:
You are not authorized to post a reply.
Author
Messages
Chesca
Veteran Member
Posts: 490
Veteran Member

    We have a custom batch program that validates input date from a csv file. The date is never formatted properly and sometimes could be mddyy, mmddyy, or mmdyy. We want the date to be reformatted as mmddyyyy. 

    If the input date is 8 digits and mmddyyyy. then continue processing. Otherwise, check if the date length and fix it. Is there a Lawson API I can use to reformat the input date to be mmddyyyy? 

    pbelsky
    Veteran Member
    Posts: 80
    Veteran Member
      Does not look like it, but this should be easy to code. If you are interested to see what date processing APIs are available, search the KB for the document called "Doc for Developers: Lawson 4GL Application Program Interfaces" for your version. In my version (9.0.1) the date processing APIs are in chapter 4.
      Chesca
      Veteran Member
      Posts: 490
      Veteran Member
        I didn't find anything in the docs for developers. So I will add logic to the program to check the character length.
        jaherb
        Veteran Member
        Posts: 164
        Veteran Member
          There is no API that will take multiple formats of the date and reformat it. You have to get that stabilized into one format and then you can change your csv attributes to match the format easily. If you are reading it into a custom program, once your reformat the date, you can use the 900-IS-DATE-INVALID to check for the correctness of a date. I always did that on pre-conversion programs just to validate them.
          Chesca
          Veteran Member
          Posts: 490
          Veteran Member
            Ok, thank you all. I ended up adding logic to get the input date stabilized into one format and using the 900-IS-DATE-INVALID.
            You are not authorized to post a reply.