Triggering question

When is a miscarriage considered a stillbirth?

Like if the baby passes away- what weeks would you have to actually deliver the baby?