The first robbery was reported at about 10:40 p.m. near 18th and Sanchez streets in the city's Dolores Heights neighborhood.
The victim, a 37-year-old man, was approached from behind by the four teenage boys, one of whom grabbed him around the waist and demanded his property, according to police.
The suspects took the man's backpack, camera, iPod and bicycle, and ran away, police said.
A short time later, at about 11:05 p.m., another robbery was reported a few blocks away near 15th and Dolores streets.
That victim, a 35-year-old man, was also approached from behind by the four suspects, but in that case one stabbed him in the back, according to police.
The suspects took the victim's backpack and ran away but they were later taken into custody, and property from the two victims was recovered, police said.
The victim who was stabbed was taken to San Francisco General Hospital to be treated for his injuries, which are not considered life-threatening.
The names of the teens, boys between the ages of 15 and 17, are not being released because they are juveniles, according to police.