Every 2-3 hours. If you just had your baby, you should plan to nurse at least every 2-3 hours, with a goal of about 8-12 feedings per 24 hrs. It is a good idea to keep track of your feedings in the first week of life. Once your milk supply comes in and your baby starts to take more milk at a time, the feeding frequency declines. This is something your pediatrician will be able to provide further guidance on.
In short - on demand. Babies essentially feed 'on demand', meaning they should eat when and how long they wish. On average that may be every 2-3 hours during the day for 30 minutes or so total. At night, it may be a bit more frequent, roughly every 1.5 to 2 hours and 30-40 minutes. Babies are meant to feed more frequently at night for several reasons and that is normal. Feeds longer than that may just be pacifying.