The actor and director said in a Facebook post Tuesday that it's the first of many steps toward a positive recovery.
He added that he wants to be the best father he can and show his kids there's no shame in getting help. He also thanked Jennifer Garner for supporting him and caring for their three kids.
Garner and Affleck have been separated since announcing their plans to divorce in 2015.
Affleck previously entered rehab for alcohol addiction in 2001.
Recently, he has stepped away from directing "The Batman" after almost a year in the job. He'll still star in the film as the titular crusader.