How long does it take for the swelling to go away sweat gland on hair line back of neck

A week or two. If it is heat-rash, it should go away in a week or two if you can keep cool and dry. Often, no treatment is needed. Topical steroid may help it go away a bit faster, but typically not really needed. If it is not a heat-rash, you may have swollen lymphnodes, they may take couple of weeks. If infected sebaceous cyst, it may need to be lanced/treated. If getting worse, consult doc. Good luck.