Date Conversions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joel

    #1

    Date Conversions


    intYear=2004
    intMonth=06

    I want to convert intYear & intMonth to 06/01/2004 thru 06/30/2004. Is there
    a way? And if it's Feb the endining day will be 28 if its Jan it will be 31
    etc.

    Thanks



  • Rick Rothstein

    #2
    Re: Date Conversions

    > intYear=2004[color=blue]
    > intMonth=06
    >
    > I want to convert intYear & intMonth to 06/01/2004 thru 06/30/2004. Is[/color]
    there[color=blue]
    > a way? And if it's Feb the endining day will be 28 if its Jan it will[/color]
    be 31[color=blue]
    > etc.[/color]

    Dim intYear As Long
    Dim intMonth As Long
    intYear = 2004
    intMonth = 6
    Debug.Print "Date range for the month is " & _
    DateSerial(intY ear, intMonth, 1) & " thru " & _
    DateSerial(intY ear, 1 + intMonth, 0)

    Note that I used the 0th day of the next month to get the last day of
    the specified month.

    Rick - MVP

    Comment

    Working...