The question may depend on the ETF or the issuer.
I am particularly interested in this ETF: UBS ETF (CH) SPI CH0131872431
I am interested in how to find out the ex-date in advance. It would be best to get a notification (newsletter or similar). But also a source where you can inform yourself is sufficient.
The reason behind this is that if you want to switch to another ETF, for example, then it would be more advantageous for tax reasons to sell before ex-dividend and buy another ETF that has already paid out the dividend.