Harry Styles is to serve as executive producer on a new sitcom loosely based around the early days of his band One Direction, it has been confirmed.

Called ‘Happy Together’, the new show will be broadcast on CBS and will be based on a real-life period in Styles’ life, when he lived with a friend, Ben Winston, and his wife in a house in the suburbs of London, when One Direction was in its embryonic stages.

Styles originally said he'd be moving in for just a couple of weeks, with a house he wanted to move into nearby needing some work before he started living there, according to a Rolling Stone interview with Winston last year. However, the pop star ended up sleeping on a mattress in the attic for 20 months.

Harry StylesHarry Styles is to executive produce a sitcom about One Direction's early days

Winston himself is now an executive producer on James Corden’s ‘The Late Late Show’ in America, and will hold down the same role alongside 24 year old Styles on the new sitcom.

More: Harry Styles takes the reins on James Corden’s show – as presenter’s wife goes into labour

‘Happy Together’ was announced as part of CBS's 2018-2019 primetime line-up reveal on Wednesday (May 16th). It will arrive in the autumn of 2018, and will reportedly be broadcast at 8:30pm on Mondays.

Kelly Kahl, president of CBS Entertainment, said: “We've maintained stability across winning nights, while adding some important new pieces to our Monday night line-up.”

One Direction is currently on hiatus as of the end of 2015, with Styles launching his solo career with a self-titled album this time last year as well as beginning an acting career with a role in Christopher Nolan’s WWII epic Dunkirk.

More: Asda bans sale of kiwi fruit to under-25s ahead of Harry Styles gig