Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Advance datefield by one month
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01395275
Message ID:
01395278
Vues:
110
This message has been marked as the solution to the initial question of the thread.
See GOMONTH() function
ldNewDate = GOMONTH(ldOldDate,1)
>I have a date field and need to advance by one month.
>
>I thought that just adding one month would work and does for dates like
>
>4/15/2009 ........ 5/15/2009
>
>However if i have 3/31/2009 and advance by one month will give me a blank date because there is no 4/31/2009
>
>
>if MONTH(ldOldDate) < 12
>   ldNewDate = DATE(YEAR(ldOldDate),MONTH(ldOldDate)+1,DAY(ldOldDate))
>else
>    ldNewDate = DATE(YEAR(ldOldDate)+1,MONTH(1),DAY(ldOldDate))
>endif
>
>
>Any suggestion to accomplish this would be appreciated.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform