A manned Mars mission would last about two Earth years. However no astronaut was continuously in outer space for that long, the record are Valery Polyakov's 437 days on Mir. If SpaceX wants to send humans to the red planet in 2024 or any other space agency having plans to send people to Mars they should be eager to hold a selection of voluntary astronauts to remain two years continuosly on the ISS. If they'd be able to handle two years living in microgravity on the ISS, they'd also handle that factor in the manned Mars mission where they would even be in some gravity while on Mars. So what are the space agencies waiting for?
Two of the crewmembers of the future Soyuz MS-19 are scheduled to stay 354 days at the ISS. That will make it the longest stay at the ISS. No crewmember has stayed for one year, much less 2 years.
Keep in mind that crew are sent up to perform work (experiments, maintenance) at the station, not merely to be occupants. It's not a hotel.