Water heater not staying hot more than 10mins
TL; DR: When the temperature is colder outside, your cold water is colder so you have to use more hot water for the same shower temperature.

Facts:


A shower head puts out 2.5 gallons per minute (GPM) (or close to it).
To get the temperature you want, you have to mix hot and cold water.
In the summer, the "cold" water temp is much warmer than it is in the winter.


Given the above facts, consider this (numbers and calculations made up)...  In the summer, to get your shower where you want it, you need to mix 70 degree "cold" water with 120 degree "hot" water to get a final temperature of 100 degrees.  This means that you have to use about half hot and half cold, so 1.25 GPM cold and 1.25 GPM hot.  That means that 20 gallons of hot water will last (20 / 1.25 = ) about 15 minutes.  This doesn't match your 30-45 minutes, but just stay with me...  It's just an example.

In the winter, the incoming "cold" temperature is much cooler.  It could get down to 40 degrees.  When you mix the 40 degree water with 120 degree water to get a 100 degree shower, you don't need nearly as much cold water.  You still have to add up to 2.5 GPM for the shower head, so the ratio ends up being more like 0.5 GPM cold and 2 GPM of hot.  That will reduce your shower time to 10 minutes - a 50% drop, and nothing in the house has obviously changed.  You probably like the shower hotter than 100 degrees, so the ratio will end up using even more hot water.

So, regardless of what the real numbers are, in the summer you end up "having more hot water" even though your water heater hasn't changed at all.

Also

As this shows, you have been using more hot water even tho your total water consumption may have gone down because of the shorter usage time.

And if you're renting an apartment, you can't replace the water heater.  Plumbing and electrical repairs must be done by their personnel so they can remain liable for any problems.