The increase in massive data processing and computing in datacenters in recent years has resulted in the problem of severe energy consumption, which also leads to a significant carbon footprint and a negative impact on the environment. A growing number of IT companies with operating datacenters are adopting renewable energy as part of their energy supply to offset the consumption of brown energy. In this paper, we focused on a green datacenter using hybrid energy supply, leveraged the time flexibility of workloads in the datacenter, and proposed a thermal-aware workload management method to maximize the utilization of renewable energy sources, considering the power consumption of both computing devices and cooling devices at the same time. The critical knob of our approach was workload shifting, which scheduled more delay-tolerant workloads and allocated resources in the datacenter according to the availability of renewable energy supply and the variation of cooling temperature. In order to evaluate the performance of the proposed method, we conducted simulation experiments using the Cloudsim-plus tool. The results demonstrated that the proposed method could effectively reduce the consumption of brown energy while maximizing the utilization of green energy.