For the last seven months, C.J. Hayes was set on joining Purdue in 2017.

But a day away from signing on the dotted line, he had a change of heart.

The three-star 2017 receiver took an official visit to Michigan State over the weekend. Now, he’s joining the Spartans in 2017.

Hayes confirmed that news to Scout.com, and cited Mark Dantonio as a primary reason for the flip.

“(Dantonio) has a proven record or winning Rose Bowls, Cotton Bowls, having opportunities on big stages,” Hayes told Scout. “He knows what he wants in players and really cares for you.”

RELATED: Your B1G guide to key National Signing Day announcements

He had committed to the Boilermakers back in June, but decided not to stick with the program after the new coaching staff took over.

The South Warren (Ky.) recruit is the No. 9 recruit from the state of Kentucky and the No. 190 wideout in the 2017 class. Hayes was the third receiver to join MSU’s incoming class.

MSU is now up to 21 commitments in its 2017 class, which ranks No. 31 overall in the 247sports class rankings.

Without Hayes, Purdue is now down to 21 commitments.