This is a bit of a tricky one. Most companies are still using ECC 6.0 and this will be the case for many years. SAP just extended their support for ECC 6.0 until 2027. However, it is slowly being phased out, and S/4HANA will eventually be the standard SAP system.
So, in the long run, S/4HANA is going to be more beneficial, but for the next few years having ECC 6.0 knowledge will be more useful since most companies are still using it now. It will depend largely on your role and what you are looking to do with the SAP skills that you gain from training.