To OP:
You need to find algorithm to determine what day of week arbitrary date is. I suggest simply googling it.
Then you will need to think how your calendar will be shown on screen, taking in account screen width.
I think, you wont be able to fit more than 3 month in single row.
After you think about it, you can start designing your program.