If the weather is not a consideration, then there is no good or bad time to visit London as attractions are mostly open all year round.
July and August are the height of summer, although that is no guarantee of sun! These would also be the most expensive months and have the biggest crowds mainly because of the school holidays and the 'good' weather.
New Year and Easter are also busy periods and expensive.
In the winter it is dark by early evening (16.00) .
In the Height of summer it is light until 22.00