A numerical technique for solving time and robust time-optimal control problems has been presented. The method relies on the special feature that the optimal control structure contains as many free parameters as there are interior or boundary conditions. Two Boundary Value Problems (BVPs) are formulated for the state variables and co-states independently, thus, reducing the dimension of the original problem into half. Then, a numerical algorithm is developed, that is based on the shooting method, to solve the resulting BVPs. The computed optimal solution is verified by comparing the control input resulting from the first BVP with the switching function obtained by solving the second BVP. Next, the numerical technique is modified to solve robust time-optimal control problems. The capability of the proposed method is demonstrated through numerical examples, whose output optimal solution is shown to be identical to those presented in the literature. These examples include linear as well as non-linear systems. Finally, the numerical technique is utilized to design a time-optimal control for a rest-to-rest maneuver of flexible structure while eliminating the residual vibrations at the end of the maneuver.