IIRC before the 3DS was officially revealed, we got news that some companies were getting devkits for the DS's successor, among them Gamefreak. I think this was back in the beginning of 2010 but I can't be sure. So the longest they could've been working on programming the game is about two years. Gameplay elements and concepts for the story and characters and new Pokemon could've been in the works for much longer.
Official Zangoose of the Pokemon X boards 3DS FC: 3609-1237-6725