A D2D communication method and a D2D communication apparatus are provided. The method includes: obtaining, by a first UE, a TDD uplink and downlink configuration and a D2D resource configuration strategy for resource configuration in the case that the first UE determines that no cell is detected; allocating, by the first UE, resources for the D2D communication based on the TDD uplink and downlink configuration and the D2D resource configuration strategy; and performing, by the first UE, the D2D communication based on the allocated resources for the D2D communication.