Date calculation

Hello Navision Folks, I have a question about the date type in Navision. If i have a Date (01.01.71) and i have a date (TODAY), how can i get the diffrent between thsi two dates? Like: current day - 01.01.71 = 30 years? Many Thanks ------------------ Best regards Alejandro Schubert CYCOS AG System Engineer www.cycos.com www.dolphinct.de EMail: Alejandro.Schubert@cycos.com

Thanks ! But i wont to have the diffrent in years not in days. How can i FORMAT the diffrent e.g 369 = 1,1 years ? Edited by - Alex on 2001 Jun 26 09:55:02

Use the command DATE2DMY to get either the year, month och day. Example: StartYear := DATE2DMY(710101D,3); EndYear := DATE2DMY(TODAY,3); Diff := EndYear - StartYear; Magnus

DifferceInYears:= (date1 - date2) / 365.25; Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117

Hi Magnus Svanfeldt says

quote:


StartYear := DATE2DMY(710101D,3); EndYear := DATE2DMY(TODAY,3); Diff := EndYear - StartYear;


But this may not look as a good solution. If we check the difference of years between 01/12/2000 and 01/01/2001 the above solution will give 1 year. But actually the differnece of this dates is only one month. Regards Joseph Mathew

My Solution Variable DateRec Reccord Date DateRec.SETRANGE(“Period Type”,DateRec.“Period Type”::Month); DateRec.SETRANGE(“Period Start”,StartDate,EndDate); Diff_Year := Round(DateRec.COUNT/12,1,’<’); Diff_Month := (DateRec.COUNT/12-MM)*12 Edited by - sak on 2001 Jul 18 04:59:36