No need to limit yourself to the area around the airports; you could spend several hours in Manhattan if you wanted to. If you took a taxi from the LGA, you'd get to Midtown around 2:30 or 3:00, and as long as you were on your way to JFK by around 6:30 (maybe half an hour earlier if you're catching an international flight), you'd be fine.