Date Formating

niimodinniimodin Member Posts: 142
Hello Experts,
Please can someone show me how to convert a date: 1 JUN 2011 to 01.06.11


  • Options
    ufukufuk Member Posts: 514
    Have a look at Format property. NAV help has lots of examples for FORMAT property:
    In your case you can use the syntax: format(today,0,'<Day,2>.<Month,2>.<Year>')
    Ufuk Asci
  • Options
    niimodinniimodin Member Posts: 142
    In my case this is how my code looks like:

    DateString := STRSUBSTNO('%1%2%3',DAY,MONTH,YEAR);
    "Starting Date" := CALCDATE('15M',FORMAT(DateString,0,2));

    Text: DAY, MONTH, YEAR
    and the information is coming from three text boxes.

    This code seeks to calculate the 15 months from a specified date
  • Options
    MBergerMBerger Member Posts: 413
    CalcDate takes a date variable as the second parameter, not a text.
    Use DMY2Date, in combination with your Day, Month and Year variables ( but make then integers ) to make a proper date, THEN use calcdate.

    [edit]Extra tip : use < > around a dateformula. That way it is not language dependent.
    NewDate := CalcDate('<15M>',OldDate) ;
  • Options
    niimodinniimodin Member Posts: 142
    It worked perfectly
Sign In or Register to comment.