You can give the landlord notice any time during the rental period, but you must pay full rent during the period covered by the notice. If you pay rent on the first day of each month, you could give notice any time during the month (presumably you did on the 15th). Then, you could leave 60 days later on August 15th, but your rent would have to be paid through the 15th. There is an exception to this rule -- if you had a written lease with your landlord and it converted to the month to month tenancy, then the terms of your written lease would still control -- check to make sure that the lease does not require notice to be given on the first of the month. In this instance, you might be liable for rent for July an August.
DISCLAIMER: Brandy A. Peeples is licensed to practice law in the State of Maryland. This answer is being provided for informational purposes only and the laws of your jurisdiction may differ. This answer based on general legal principles and is not intended for the purpose of providing specific legal advice or opinions. Under no circumstances does this answer constitute the establishment of an attorney-client relationship. For legal advice relating to your specific situation, I strongly urge you to consult with an attorney in your area. NO COMMUNICATIONS WITH ME ARE TO BE CONSTRUED AS ARISING FROM AN ATTORNEY-CLIENT RELATIONSHIP AND NO ATTORNEY-CLIENT RELATIONSHIP WILL BE ESTABLISHED WITH ME UNLESS I HAVE EXPRESSLY AGREED TO UNDERTAKE YOUR REPRESENTATION, WHICH INCLUDES THE EXECUTION OF A WRITTEN AGREEMENT OF RETAINER.