kW = kWh/h

You first need to translate kWh into %SoC, then any kW rate gives you %SoC/h.

Then

1) if you have a nice function that describes %SoC/h for a given %SoC you can use calculus: you'd need the integral, and then you can do integral(high) - integral(low) to calculate the time taken.

EDIT: er, wait, no, not quite. You'd want the reciprocal that gives h/%SoC, then integrate over %SoC to give you hours.

2) if you have a table of discrete rates at different %SoC, then you could:

a) calculate a conservative average rate between subrange of %SoC

b) then time = sum[pairs of %SoC]( (<high %SoC> - <low %SoC>) /<average %SoC/h> )

To help understand the second case, imagine you had a _constant_ charging rate of X%SoC/h.

Then it would be easy to calculate the time: (stop% - start%)/X hours.

If you can break down the start to stop range into parts, each with own average charging rate, you can calculate the time for each part and then add them up.