Studying the interrelationship between green bond markets and ESG stock markets is crucial for promoting sustainable development in the face of environmental concerns. This paper explores this interrelationship across a range of time scales and market conditions by conducting wavelet analysis, quantile Granger causality test, and quantile-on-quantile regression (QQR) analysis, using data from January 5, 2015 to December 31, 2021 with 1705 observations of each variable. The results show that the green bond markets and the ESG stock markets in USA present a strong correlation, especially in response to external events. Additionally, we observe quantile Granger causality form green bond markets to ESG stock markets in both China and USA at all time scales. The QQR results suggest that the impact of green bond markets on ESG stock markets is significant under extreme market conditions in both countries. When both markets are in the lower quantiles, green bond markets would positively impact ESG stock markets in the short-term, but the impact turns out to be negative as the time term extends. Furthermore, the results in China and USA demonstrate some differences. When green bonds market is in the higher quantiles, green bonds markets would negatively impact ESG stock markets in both countries in the short-term. However, unlike that in China, the impact of in USA becomes positive as the term is longer, implying significant differences between the influencing mechanisms of the markets in these two countries.