First of all, you need to go to a good store with nice reputation. Most normal manufactured sunglasses are discharged from factory with supporting specification. You can read this specification to make sure whether the sunglasses pass UV400 test. When there is no formal specification at hand, you may check the label hanging on one leg of sunglasses. Generally, most manufacturers print basic parameters of products on the label. You can get information about UV400 there. Additionally, there is a practical way to identify sunglasses. Take a portable money detector which use ultraviolet ray to identify currency. Turn on the money detector. Let the ultraviolet ray to reflect on the money through sunglasses lenses. If the sunglasses are UV400, you can not see the anti-fake mark in the money. Instead, if you can still see the mark, the sunglasses may not be UV400. Oh, but before that you shall may sure you are looking at a real money.
If you want to check whether the sunglasses you buy own the character of uv 400, you could check it from the brand mark which is usually hung on the frame side. It will be marked with this. If the sunglasses are the real ones, this mark will be true.
Yes, of course, sunglasses with UV functions are better to protect your eyes from strong lights. So, there are many ways to tell that. Generally speaking, you should ask for something like instructions to the sunglasses, read it carefully before you buy. Also, sometimes there will be a sign on the frame which is easy to be found. Or you can ask the salesman about it. Just try to be careful.