Whenever you want a solution, come out with the truth, so that learned and experienced members of the community will show you the right path. In your posting, two things are mentioned: one is "Resigned in the month of May," and the second one is "Terminated in the month of August." This gives me the impression that your new employer terminated you from the job you took in May 2017 after resigning from the first job. Your reasonable job continuity is up to May 2017.
You are not alone; there are many people with job discontinuity who have still secured jobs. Job selection is a skill, and if one matches the skill requirements of the employer, the employer will still want to know the reason for the gap. There are several reasons (family, health, higher study, etc.) for which people leave jobs. One should skillfully offer an explanation that is beyond doubt. Do not allow anyone to act on you; be genuine.