Formula to calculate how long to pay off credit card debt?

example input:
Amount that you owe: $500
APR: 29.99%
Monthly payment: $19

I need to know how to calculate how many months that it will take to pay off. Thanks!

P.S. I do not have credit card debt. I just want to program a calculator. =)
6 answers 6