If you have been properly served with an unlawful detainer lawsuit, you should immediately hire an expert attorney to represent you at your court hearing. I would not wing it. I cannot understand the details of the dates you provide. But your lawyer can sort all that out. Get some help. Make sure to ask the attorney if they specialize in unlawful detainer defense of tenants.
Disclaimer: Ms. Kermani is an attorney licensed to practice in California. This post does not constitute legal advice, should not be relied upon as such, and does not create an attorney client relationship. Since each solution is fact specific, please consult an attorney and provide them with all the facts and documents at issue. Only then can you receive legal advice tailored to your specific situation.