Except in relation to flying or jet lag, I think it is probably bad form to ask or give advice about sleeping medications on this forum.
Having said that, Ambien is designed to be short-acting. This makes it ideal for use on red eyes. It allows you to get to sleep and will wear off before landing. As a rule-of thumb, 5mg will last about 4 hours and 10mg about 6 hours. Ambien CR is probably not as good an option in flight. Of course, every person may react differently, especially if there are comorbidities. Never take a sleeping medication for the first time while traveling.
For the same reason, Ambien may not be ideal for jet lag, especially west-bound. OTC medications are benadryl or similar antihistamines. These will generally be effective for more hours but will have a greater tendency to leave people groggy.