Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GOMONTH() conundrum
Message
De
29/11/1999 13:13:04
 
 
À
29/11/1999 12:26:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00296419
Message ID:
00296458
Vues:
18
>Hi folks!
>
>The GOMONTH() function, as you may know, returns a date that is "n" months ahead of or behind the supplied date value. For example, GOMONTH(DATE(),12) will return 11/29/2000. This is good.
>
>Now, the value of DATETIME() is 11/29/1999 12:22:23 PM. GOMONTH(DATETIME(),12) returns 12/29/2000 (yes, a date and not a datetime). This is bad.
>
>If you have something that goes into effect at 12:00:00 PM on 11/29/1999, what would you do to automatically determine that it expires 11:59:59 AM on 11/29/2000?
>
>I came up with a way but it's klunky. Anybody have any ideas?

Try:

FUNCTION AdvanceDateTimeByMonths
LPARAMETER ttDateTimeBase, tnNumMonths
LOCAL nSecsPassed
nSecsPased = ttDateTimeBase - DTOT(TTOD(ttDateTimeBase))
RETURN DTOT(GOMONTH(ttDateTimeBase,tnNumMonths)) + nSecsPassed - 1
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform