it should depends on your prescription and the type of glasses . If your glasses are made for long time wear ,such as the progressive glasses, it is ok ,but they will not make your vision better or worse .if you have high prescription which is more than 400 ,then you'd better wear them all the time . Occasional wearing will impair your vision .but if your prescription is low , you'd better wear them only when you need . Long-time wearing can cause your prescription go higher .
It depend on you. Of course, your prescription is also an important factors. If you have a mild prescription, and the vision defects will not affect your daily life, you may not need to wear it all the time. and just wear them when you need. But if you have strong prescription and you can't see anything if you won't wear it. Surely, you need to wear eyeglasses all the time.