With the increasing penetration of electric vehicles (EVs), charging of EVs is one of the main causes of the peak load of a power system. Therefore, the integration of EVs with renewable energy systems is one of the main pillars that reduce peak demand and environmental impact, especially in urban areas. However, the uncoordinated charging of EVs may lead to ineffective use of renewable energy sources. In this context, an optimal energy scheduling strategy has been proposed for charging electric vehicles from a grid-connected photovoltaic system (PV) in the charging station. This proposed strategy is built to schedule the charging of EVs based on the PV generation curve, the arrival and departure time of EVs, the energy required for every EV, and the state of charge of every EV battery. The objective is to reduce the charge of EVs from the grid and increase their charge from the photovoltaic system as much as possible while ensuring the energy needed for the EVs journeys. To evaluate this strategy, the simulation on a sunny day and cloudy day were conducted. The simulation results show the effectiveness of the proposed strategy in reducing the charge of EVs from the grid from 30% to 12% on a cloudy day and from 26% to 8% on a sunny day. In contrast, the EVs charge from PV increases from 70% to 88% on a cloudy day and from 74% to 92% on a sunny day.