Formal:
* Passez un bon moment (pronounced: pah-say un boh mo-mahn) - This is the most formal and literal translation.
Informal:
* Amuse-toi bien (pronounced: ah-muze-twah bee-en) - This is a more informal and friendly way to say it, especially when talking to someone younger or someone you know well.
* S'amuser (pronounced: sa-mu-zay) - This is a verb meaning "to have fun" and can be used on its own.
You can also use "Profitez bien" (pronounced: pro-fee-tay bee-en) which means "Enjoy yourself." This is a more versatile phrase that can be used in both formal and informal contexts.
Ultimately, the best way to say "Have a good time" in French depends on the situation and who you are talking to.