Environmental crisis and shortage of fossil fuels make Electric Vehicles (EVs) alternatives for conventional vehicles. With growing numbers of EVs, the coordinated charging is necessary to prevent problems such as large peaks and power losses for grid and to minimize charging costs of EVs for EV owners. Therefore, this paper proposes an optimal charging schedule based on Dynamic Programming (DP) to minimize the overall cost of charging EVs for consumers in a solar Charging Station (CS). The large state space that makes the use of general DP inefficient is handled by using modified DP. Also, due to the stochastic behavior of the PV production, four different cases accounting for four different weather conditions are considered. Simulations are done for each weather condition and potential cost savings for customers and benefits for the grid are investigated in comparison to uncontrolled charging in each case. Simulation results demonstrated a significant decrease in the total CS purchased power cost, indicating reduced costs for consumers. Also, the optimal charging schedule shifts the charging sequence of EVs from high demand hours to low demand hours, to keep a smooth load shape for the distribution grid.