Simultaneous Congruence of Two Matrices

Could you please let me know an answer to the following question on simultaneous congruence of two matrices. This question came up while trying to handle a system of PDE.

QUESTION:

Let $A,B\in M_n(\mathbb{R})$, let $A$ be symmetric and let $B$ skew-symmetric. It is known that

i) Sylvester's Theorem: $A$ is congruent to $D$ i.e. for some $Q\in GL_n(\mathbb{R})$, $Q^t A Q=D$, where $$D:=\operatorname*{diag}\left(\underbrace{1,\ldots,1}_{p\text{-times}},\underbrace{-1,\ldots,-1}_{q\text{-times}},\underbrace{0,\ldots,0}_{(n-p-q)\text{-times}}\right),$$ where $p,q$ stand for the number of positive and negative eigenvalues of $A$, respectively.

ii) Darboux Theorem: $B$ is congruent to $J_m$ i.e. for some $R\in GL_n(\mathbb{R})$, $R^t B R=J_m$, where $$J_m:=\operatorname*{diag}\left(\underbrace{\left( \begin{array}{cc} 0 & 1 \\ -1 & 0 \\ \end{array} \right),\ldots,\left( \begin{array}{cc} 0 & 1 \\ -1 & 0 \\ \end{array} \right)}_{m\text{-times}},0,\ldots,0 \right),$$ where $\operatorname*{rank}B=2m$.

When is $A,B$ simultaneously congruent i.e. there exists a $P\in GL_n(\mathbb{R})$ such that

$$P^t A P =D\text{ and }P^t B P = J_m?$$ Is there any necessary and sufficient condition?