Lets say I have $40,000 of long-term capital gains in Q1 2021, and my federal tax due is exactly $6,000 (i.e. 15% of $40,000).
Then the tax on that gain realized in 2021, as a quarterly tax payment would be due to the IRS by Apr 15th.
Also, lets also say I am a CA resident.
Pretty much the same applies for CA state taxes with the same quarterly due dates as the IRS has for federal taxes. See https://www.ftb.ca.gov/pay/estimated-tax-payments.html for more guidance.