Chapter 7: If the you obtained a discharge in (a) a Chapter 7 case filed within the past 8 years, you cannot obtain a discharge in a Chapter 7 case. After 8th year you can file.
Chapter13: If a Chapter 13 case filed within the past 6 years and discharged. After 6th year you can file.
How do I know when time period ( 8 years / 6 years) is completed to file?
The time periods in either case are measured from the commencement dates of the respective cases. The dates of discharge is not relevant for this purpose.