It's based on the average rating in each rating list from the 1st of January 2017 to the 1st of December 2017. There are a number of other requirements (had to play in either the World Cup 2017 or Grand Prix 2016/2017, minimum of 30 games played over that period).
http://www.fide.com/FIDE/handbook/regscandidates2018.pdf
Section 2.4
As we know the two highest elo players who don't qualify by other means like the World Cup etc will be part of the candidates. However the rankings keep changing. Someone who is in top two elo could lose a few games and drop down. So what is the cut off date on which the elo is considered for selection into candidates.