In this paper, we consider a class of optimal control problems where the dynamical systems are time-delay switched systems with the delay being a function of time. By applying the control parameterization method, the control heights and switching times become decision variables that need to be optimized. It is well-known that, for this type problem, the variable switching times cannot be optimized directly. To work around this problem, we introduce a time-scaling transformation technique so that the original system is transformed an equivalent system, which is defined on a new time horizon with fixed switching times. Based on the relationship between the original time scale and the new time scale, we derive the gradients of the objective and constraint functions with respect to the control heights and durations. Then, the new problem can be solved by gradient-based optimization approach. To demonstrate the effectiveness of the time-scaling transformation technique, two example problems are solved.