Most of us would prefer to forget those awkward years where we couldn’t get a date — but NBC’s new comedy, “Undateable,” hopes that viewers still have some nostalgia left for that time in their lives.

Premiering Thursday at 9 p.m., “Undateable” stars Chris D’Elia (“Whitney”) as Danny, a 29-year-old man-child/Lothario who offers to help his new roommate Justin (Brent Morin) and his group of oddball friends try to find relationships.

“Everybody on Earth — men and women — go through an undateable phase in their life, due to bad jobs or insecurities or money or the way they dress,” says executive producer Bill Lawrence (“Scrubs,” “Cougar Town”).

“And most of us get out of it. [This] is about a group of friends that are stuck there a little bit.”

Lawrence remembers his own undateable phase of bleached-blond hair and earrings while he was producing “Spin City” in the late 1990s (he’s now married to actress Christa Miller). D’Elia, who is single, can still relate to the feeling of consistently striking out.

“It’s tough to be in LA and find somebody that you really connect with on a real level,” he says. “I just feel like I’m undateable the whole time, my whole life.”

Despite the premise, Lawrence says only a couple of episodes will focus on getting somebody a date. The majority of the show takes place at Justin’s unsuccessful bar, Black Eyes, where the gang — along with Danny’s recently divorced sister Leslie (Bianca Kajlich) — hangs out and helps solve each other’s problems.

In casting the show, producers looked for a group of people who were friends in real-life — and comedians D’Elia, Morin and co-stars Ron Funches and Rick Glassman all knew each other from years on the stand-up circuit.

“Part of the battle in a sitcom is making it seem like people are friends and have chemistry,” Lawrence says. “In the modern landscape, you only have a couple episodes to establish that. It kind of helps that all these guys and girls hang out.”

Casting a bunch of comedian friends also helped with the show’s multicamera format, where episodes are filmed in front of a live studio audience.

On “Undateable,” producers shot one take of the script and then let the stars loose to improvise (outside of the pilot, the episodes are 50 percent ad-libbed).

“Since we all do know each other … we all know each other’s rhythms, so it’s very easy to ad-lib if we want to,” D’Elia says, “because we know what type of humor is coming.”