Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Month Calculations
Message
De
23/04/2001 09:07:06
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
20/04/2001 19:10:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00498208
Message ID:
00498538
Vues:
21
>We need to determine exactly how many months difference there is between 2 dates in VFP
>Example:
>01/01/2001 - 03/01/2001 = 3 months
>
>We are currently trying the following:
>x=date1 (01/01/2001)
>y=date2 (03/01/2001)
>z=y - x
>b=z/365*12
>c=b +1
>
>result=int(c)
>
>The problem we are running into is short months
>
>
>Larry
lparameters tdStart, tdEnd
local ldStart, ldEnd, lnMonths
ldEnd = max(tdStart,tdEnd) && Swap start-end if necessary
ldStart = min(tdStart,tdEnd)
lnMonths = int((ldEnd-ldStart)/28) && Max possible months
do while gomonth(ldStart,lnMonths)>ldEnd
	lnMonths = lnMonths - 1
enddo
return lnMonths
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform