Thanks!
Ah... that was the formula I needed, I was somehow getting lost with formulas about RC time.
Look, that is quite simple.
A resistor is a component with constant voltage/current ratio: I = U/R
A capacitor is a component with constant voltage speed/current ratio: dU/dt = I/C
An inductor is a component with constant current speed/voltage ratio: dI/dt = -U/L
Here, dU/dt and dI/dt mean derivatives (as in calculus), that is, they represent momentary speed. dt should be very small (infinitely small).
If we want to calculate the voltage change for a finite time, let's do the following. Consider the capacitor C is charged from source Us via resistor R. The voltage on the capacitor depends upon time and is U(t). Consider that the capacitor is initially discharged, U(0)=0.
It's obvious that I = (Us - U)/R in this circuit. Substituting the capacitor equation C*dU/dt for I, we get
dU/dt = (Us - U)/(RC).
Rewrite as follows:
dU/(U-Us) = -dt/RC
Now integrate both parts of the equation:
ln(|U-Us|) = const - t/(RC)
Since U < Us,
ln(Us-U) = const - t/(RC)
We have to find const. Note that for t=0
ln(Us-0) = const
and thus
ln(Us-U) = ln(Us) - t/(RC)
or
ln(Us-U)-ln(Us) = -t/(RC)
Finally,
ln((Us-U)/Us) = -t/(RC)
or, the same
Us-U = Us*exp(-t/(RC)).
Here RC is called "time constant".
For discharging it's done in a similar way.