President Barack Obama gestures as he announces he will nominate Charlotte, N.C. Mayor Anthony Foxx to succeed Ray LaHood as Transportation Secretary, Monday, April 29, 2013, in the East Room of the White House in Washington. (AP Photo/Jacquelyn Martin) (Jacquelyn Martin/AP)

President Obama opened up a bit about growing up without a father Friday, telling some troubled young dads that they can salvage their relationships with their children.

During a visit to Baltimore's Center for Urban Families, Obama listened to stories from a father who struggled to find work to support his family and another who served time in jail.

Obama then likened the situation to his own.

“You know, one of the biggest challenges – I grew up without a father,” he said, according to a pool report. “You know, I always tell people that, as great and heroic a job as moms do, particularly for boys, that’s a hard situation.”

Obama added: “For your sons to see you taking this path, that’s going to make all the difference in the world. And in some ways, the fact that you started off a little rocky helps” because it can show them how far you came.

It's not the first time Obama has talked about his father's absence. In February, during the gun debate, he talked about the need for strong families.

"I turned out okay,” he said. “But at the same time, I wish I had had a father who was around and involved.”