Calc number of days in a month

Looking for some help on capturing the number of days in a month to set as a loop counter. Any ideas, please let me know.

cal | awk 'END{print $NF}'

Thanks for the reply...

I understand the cal and awk but not clear on the 'END{print $NF}'

Are you setting the number of fields? ($NF)?

No, I'm telling it to print the last field on the last line. The END block is execute after the entire file has been read, so the current line is the last line.