Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Handling Dates Beginning of Month and End of Month
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01512731
Message ID:
01512790
Views:
50
>We know that February's numbers of days varies from 28 to 29 depending on if the year is a leap year.If you want to get the ending date of a month and don't want to deal with determining the leap year, how would you do this?
>
>Cecil

My functions:
ldDate = DATE(2012,02,01)

? BoM(ldDate)
? EoM(ldDate)
? NDoM(ldDate)

*-- Begin of month
FUNCTION BoM(tdFecha)
  RETURN DATE(YEAR(tdFecha),MONTH(tdFecha),1)
ENDFUNC

*-- End of month
FUNCTION EoM(tdFecha)
  LOCAL ld
  ld = GOMONTH(tdFecha,1)
  RETURN ld - DAY(ld)
ENDFUNC

*-- Number of days of the month
FUNCTION NDoM(tdFecha)
  LOCAL ld
  ld = GOMONTH(tdFecha,1)
  RETURN DAY(ld - DAY(ld))
ENDFUNC
Luis María Guayán
Tucumán, Argentina
________________________________
SysOp de www.PortalFox.com
Nada corre como un zorro
________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform