Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Posts
    119

    Unanswered: Function that would count the no. of days in a month?

    Good day to evryone,

    I have some questions:
    1.) Is there a function in VB where I can count the no. of days in a month?
    2.) Is there a function that would result to the number equivalent of a month?
    Ex. JAN=1, FEB=2,....

    Thank you so much.

  2. #2
    Join Date
    Oct 2004
    Posts
    24

    :)

    Use the Month(date) function to return the number of a month.

    Ex. Month(1/30/2006), returns 1 for Jan.

    Use the Datediff() function to determine the number of days in a month or even in a range of date.

  3. #3
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    to get the last day of the month,
    • build a date based on a given month and year, with the day = 1. (ex: 1-OCT-2006)
    • Use the DateAdd function to add 1 Month to this date (ex: 1-NOV-2006)
    • use the dateadd function to add -1 day to the prior result. (ex: 31-OCT-2006)

    The result is the last of the month.
    Last edited by loquin; 10-18-06 at 17:47.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •