Convert a string on date

DurandDurand Member Posts: 61
edited 2002-02-15 in Navision Financials
Hello,
how I can make to convert a data string, on a data date.
Thank you, Benoît

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Look at the EVALUATE function.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • giovannigiovanni Member Posts: 4
    Hi,

    this procedure convert a string (example: 20012512) in a date. The variable is
    Day, Month, Year are TEXT.
    D, M, Y are INTEGER.

    you can use this.......

    Day := COPYSTR(String,7,2);
    Month := COPYSTR(String,5,2);
    Year := COPYSTR(String,1,4);
    EVALUATE(D,Day);
    EVALUATE(M,Month);
    EVALUATE(Y,Year);
    "Data Field" := DMY2DATE( D, M, Y);

    or this.....

    EVALUATE(D,COPYSTR(String,7,2));
    EVALUATE(M,COPYSTR(String,5,2));
    EVALUATE(Y,COPYSTR(String,1,4));
    "Data Field" := DMY2DATE( D, M, Y);

    bye
    Giovanni
Sign In or Register to comment.