Bonne nuit (good night) is used when going to bed or leaving a house in the evening.On leaving a shop you may be wished bonne journée (have a nice day) or variations such as bon après-midi, bonne fin d’après-midi, bon dimanche or bon week-end, to which you may reply vous aussi, vous de même or et vous.
As a foreigner you will probably be excused if you accidentally insult your hosts, but it’s better to be aware of accepted taboos and courtesies, especially as the French are much more formal than most foreigners (especially Americans and Britons) imagine.
It’s also customary to say good day or good evening ( bonsoir) on entering a small shop and goodbye ( au revoir madame/monsieur) on leaving.
Bonjour becomes bonsoir around 18.00 or after dark, although if you choose bonsoir (or bonjour), don’t be surprised if the response isn’t the same.
Things will be slightly different if they’re both foreigners in a third country.
Knowing these local rules is of an utmost importance.