Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating a number with dates
Message
 
 
À
10/12/1999 12:23:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00301801
Message ID:
00301807
Vues:
22
>Hi all,
>
>I am having a problem doing some calculations and am not sure how to best get around it.
>
>I am trying to calculate number of days as follows:
>
>45-((date()-[date1])-[date2])
>
>The problem I am having is that the first part (date()-[date1] is evaluating to a number and then trying to subrtract the date from it which gives me a operator/operand type mismatch(of course) but how to I get around it, I mean is there a way to subtract 3 dates and getting a number at the end. I have tried changing the parenthesis to have it evalueate all the date fields first but can not seem to get by the error.
>
>Thanks for the help
>James

When you do math with 2 dates you get a number. When you do math with a date and a number, you get a new date. So, you can not do math with 3 dates and get a number. You can only get a date because the math with the first 2 dates gives a number which, when used with the 3rd date gives you a new date. Now you are left with the new date and your number [45, in this case]. Therefore all you can get from your equation is a date.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform