I’m 22, been out of school for years and forgot all my math, and want to go back and get a CS degree.

Do I need to relearn everything from the beginning, and how long would it probably take? Hopefully not months and months but I imagine I can’t relearn everything in a couple weeks.
4-6 weeks to get to precalc. Then a full semester precalc course and you should be ready.  Failed math in highschool. Started over at 26 took Aleks math assessment and tested into algebra. Followed the modules as described above retested into precalc.-- got an engineering degree now so it can be done
As someone who liked math in high school and squeezed by College Algebra. I recommend going back and starting at intermediate algebra. When I decided to go back for my engineering degree, I could have started in pre calc but decided against it and started in intermediate. I made a foundation from what I already knew and helped make more sense of the advance stuff I was going to be doing.
Well to get the CS degree you probably need Calc 1 and 2, and Discrete Math. Anything else on your degree plan?

You need to master Algebra to be in a position to take Pre Calc. If you also master trig, you may be able to place out of precalculus. How does your university place people in math?
well it depends what you currently know. can you explain how to solve 2x-7 = 5x-3 or 3x^(2)-4x-15 = 0? can you explain why a^(b)a^(c) = a^(b+c) or why sin(30°) = 1/2? etc.

also why do you want to do a cs degree? cs is a branch of math and a cs degree will consist mostly of math and theoretical stuff.
It took me about a year.

Re-learning things is a lot quicker than learning for the first time. I can't say how long it'll take you, but I bet you could get through it reasonably quickly.

Take their introductory CS courses while you're there! Learning CS and math at the same time will help you learn each faster.
Things will come to you as you go. I recommend using *Math Is Fun* for the basic arithmetic and algebra, and reinforce with *Khan Academy*. Then a few resources online for Pre-Calc.

A CS curriculum usually includes a couple of introductory Maths courses, so you should be good there too.
Depends on you, I could probably run through the whole thing in 2 weeks.
Honestly just start with college algebra. You may test into precalculus but it's a rough course.
by
It's going to differ wildly from person to person. But one thing that I would say is don't worry too much about not being optimally prepared for the start of your degree. When I started my maths degree after being out of high school for a while, I had literally forgotten how to expand (ax+b)(cx+d). I remember my TA thinking that I was joking at first, and then looking at me in horror as she realised I genuinly didn't know how to do it.

Needless to say, the first few weeks were a bit rough, but if you have the aptitude for it, it will come back to you quickly enough and you'll be caught up in no time. And you don't even need to do particularly difficult maths for CS. As long as you're hard working and don't have dyscalculia, you'll be totally fine.