I have a month and a year "mm/yyyy". I want to calculate the number of days in that specific month of that year. So for example: 01/2013 would be 31. The number of days are important because I have a calculations I need to do off of that. I have seen the DateDiff function to find the number of days in the current month, but I do not know how to translate this into what I need.
First of month: DateSerial(YourYear, YourMonth, 1)
First of next month: DateAdd(mm, 1, FirstOfMonth)
[ OR: DateSerial(YourYear, YourMonth + 1, 1) ]
Number of days in month: DateDiff(dd, FirstOfMonth, FirstOfNextMonth)
You sir, have hit the nail on the head. Thank you for your help! That worked perfect!
SELECT DateSerial(DatePart("yyyy",[RDate]),DatePart("m",[Rdate]),1) AS [First of month], DateSerial(DatePart("yyyy",[RDate]),DatePart("m",[Rdate])+1,1) AS [First of next month], DateDiff("d",[First of month],[First of next month]) AS [Number of days in a month]