EU regulations enter into force when they are passed by the European Parliament (if it sets a date) or 20 days after they are published in the Official Journal of the European Union (if it doesn’t).
The GDPR was passed by the European Parliament on 27 April 2016. It was published in the Official Journal on 4 May 2016, entered into force 20 days later on 24 May 2016 and, after a two-year transition period, came into effect on 25 May 2018.