Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date calculation problem
Message
 
To
27/12/2001 14:55:28
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00598520
Message ID:
00598567
Views:
18
>>>Nick,
>>>
>>>I get 1.7 using your formula and dates.
>>>
>>>Renoir
>>>
>>>>I am having problem with the following formula
>>>>ROUND(((DATE()-(DATE()-Payroll_tbl.edate))-Employee.e_cntysnrdte)/365.25,1)
>>>>
>>>>
>>>>where my Payroll_tbl.edate = 11/30/01 and my Employee.e_cntysnrdte = 03/11/00
>>>>I get the result of 101.7 instead of 1.7
>>>>
>>>>
>>>>
>>>>Thanks
>>>>Nick Patel
>>I am actually using this formula in a query like the following to generate a report:
>>
>>SELECT Payroll_tbl.pp, Employee.e_fname, Employee.e_lname, Employee.e_mi,;
>>  Employee.e_dob,;
>>  ROUND(((DATE()-(DATE()-Payroll_tbl.edate))-Employee.e_dob)/365.25,1),;
>>  Employee.e_cntysnrdte,;
>>  ROUND(((DATE()-(DATE()-Payroll_tbl.edate))-Employee.e_cntysnrdte)/365.25,1),;
>>  ROUND(Payroll_tbl.slbal*Payroll_tbl.rate,2),;
>>  ROUND(Payroll_tbl.vacbal*Payroll_tbl.rate,2),;
>>  ROUND(Payroll_tbl.slbal*Payroll_tbl.rate,2)+ROUND(Payroll_tbl.vacbal*Payroll_tbl.rate,2);
>> FROM  employee!employee INNER JOIN payroll!payroll_tbl ;
>>   ON  Employee.e_ssn = Payroll_tbl.ssn;
>> WHERE Employee.e_empstatus = 4;
>>   AND Employee.e_dob <> {  /  /  };
>>   AND Payroll_tbl.pp == ?lc_pp;
>> HAVING Employee.e_ssn=Payroll_tbl.ssn=.T.;
>> ORDER BY 8 DESC, Employee.e_dob DESC
>>
>>The problem is sometimes I get 107.1 result and other times I get 1.7 result. As for SET CENTURY, it is set to ON. I checked using disp status. Baffling isn't it?
>>
>>Thanks
>>Nick Patel
>
>Nick,
>
>Did you check the data itself to make sure there are no "1900" years? Is it being stored as 2 or 4 digits for the year in the field? If I substitute 1900 instead of 2001 I get the 101.7 like you are.
>
>Renoir


You were right, my user put 1900 instead of 2000. I seem to miss the obvious, thanks again.

Nick Patel
Previous
Reply
Map
View

Click here to load this message in the networking platform