First and Last Day of actual Month

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 4vTurbo
    New Member
    • Dec 2011
    • 2

    First and Last Day of actual Month

    Is there a function to get the first and the last day of the actual month?

    Regards
    4vTurbo
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    The first day of a month is always the same. For the last day, you can take the first day of the next month and subtract a day.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32633

      #3
      For the first day you can format a string starting with "1/" (or including "/1/" if American) and converting that to a date, or you can use the Day() and DateAdd() functions to move to the correct date :

      Code:
      CDate(Format(Date(), "m/1/yyyy"))
      DateAdd("d", 1 - Day(Date()), Date())
      For the last day you would go back one day from the first of next month :

      Code:
      DateAdd("d", -1, CDate(Format(DateAdd("m", 1, Date()), "m/1/yyyy")))

      Comment

      Working...