Let \(\underline{E}=\prod_{p\in\mathbb{P}}E_p\) be a compact subset of \(\widehat{\mathbb{Z}}=\prod_{p\in\mathbb{P}}\mathbb{Z}_p\) and denote by \(\mathcal C(\underline{E},\widehat{\mathbb{Z}})\) the ring of continuous functions from \(\underline{E}\) into \(\widehat{\mathbb{Z}}\). We obtain two kinds of adelic versions of the Weierstrass approximation theorem. Firstly, we prove that the ring \({\rm Int}_{\mathbb{Q}}(\underline{E},\widehat{\mathbb{Z}}):=\{f(x)\in\mathbb{Q}[x]\mid \forall p\in\mathbb{P},\;\;f(E_p)\subseteq \mathbb{Z}_p\}\) is dense in the direct product \(\prod_{p\in\mathbb{P}}\mathcal C(E_p,\mathbb{Z}_p)\,\) for the uniform convergence topology. Secondly, under the hypothesis that, for each \(n\geq 0\), \(\#(E_p\pmod{p})>n\) for all but finitely many \(p\), we prove the existence of regular bases of the \(\mathbb{Z}\)-module \({\rm Int}_{\mathbb{Q}}(\underline{E},\widehat{\mathbb{Z}})\), and show that, for such a basis \(\{f_n\}_{n\geq 0}\), every function \(\underline{\varphi}\) in \(\prod_{p\in\mathbb{P}}\mathcal{C}(E_p,\mathbb{Z}_p)\) may be uniquely written as a series \(\sum_{n\geq 0}\underline{c}_n f_n\) where \(\underline{c}_n\in\widehat{\mathbb{Z}}\) and \(\lim_{n\to \infty}\underline{c}_n\to 0\).