Image of Navigational Panel mapped to Contents / Home / Search VB Code for Finding Days
Tech Support Question

Image of Line Break

Q. What's a quick way I can find out how many days are left in a given month?

A. Here's a little one liner that I use to find how many days are left in any given month. Simply pass it today's Date and it spits back the number of days left till the first of next month. I use this to do billing.

  Function daysLeft (vDate) As Integer
    daysLeft = DateDiff("d", 
                        CVDate(Str(Month(vDate)) & "/01/" & 
                        Str(Year(vDate))), 
                        DateAdd("m", 1, CVDate(Str(Month(vDate)) & 
                        "/01/" & Str(Year(vDate))))) - Day(vDate)
  End Function

Tony Willingham.
Email : gigantor@chattanooga.net


Image of Arrow to Previous Article

[TECH SUPPORT TOC]
Image of Line Break
[HOME] [TABLE OF CONTENTS] [SEARCH]