Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Logic problem involving dates
Message
De
23/06/1999 12:34:18
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
23/06/1999 09:48:51
Andrew Hanney
Sgai (Ireland) Ltd.
Dublin, Irlande
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00232956
Message ID:
00233051
Vues:
31
>I have two dates, a start date eg 06/06/1999 and maturity date e.g. 06/03/2000 . The scenario is I have to make valuations on dates falling back from the maturity date at intervals of three months ie. For example, on 06/03/2000, 03/03/2000, 12/03/1999, 09/03/1999. The problem is how to programmatically calculate these dates, specially if the maturity date is the 31st, and 3 months previously, the month was only 30 or 28 days long. If anyone has done anything this before could you let me know, I’d appreciate it.

Just use

GoMonth(EndDate, -nMonths*3).

If it's a 31st of February, it will fall back to 28th or 29th. Or you can calculate the average length of a quarter of a year (91.25 or 91.5 days), round to an integer and subtract that from the end date, like

EndDate-round(90.25*i, 0)

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform