Great thing about meditating , you can do it anytime. Some people have preferences on when and or where they meditate, but do it whenever you feel it's right. An you can meditate for however long you want. I would suggest at least ten to twenty minutes in any one session. But again do it for however long you feel comfortable doing it. And meditation can help you relax and sleep but some people can get energized from the meditation because of the energy they get while meditating.
I wouldn't suggest meditating right before you go to bed. You're more likely to fall asleep during Meditation if you wait until your physically tired.
As for the amount of time spent: I started with 5 minutes twice a day. The reason for the short periods was due to having a short attention span. After I practiced and started to overcome my attention issues, I spent 30 minutes twice a day.
Do whatever feels comfrotable to you; be that 5 minutes or an hour. Just be careful not to allow it to take from your daily life. Meditation can offer quite a bit of relaxation and some become a bit addicted to it.
Yeah, like the commenter above me, you probably will fall asleep. I've done it countless times! Do it in small increments until you can focus for long. I still only meditate in 5-15 minute increments because I simply don't have time to sit for a long time. Any amount of time is good.
And I know you didn't ask but please don't count your breathing, like 7 in and 7 out. It won't help you relax at all, just breathe as deeply as you feel comfortable.
As the ones who posted above stated, meditation can be done at anytime and for any length of time. I personally practice meditation at least twice a day. As soon as I wake up in the morning for about 15-20 minutes I have my "wake up" meditation and before I go to sleep at night I have my "night-night meditation". These meditations are slightly different since the goal of each of the meditation is different.
Meditation is about being aware and thought flow. Many will say it is about thoughtlessness but I don't think that term describes meditation accurately enough. As you meditate you reach a state of awareness period. What you become aware of varies each time you meditate. During meditation you are not to hold onto thoughts, they are to flow. As a thought comes in you are to acknowledge said thought and then let it go. Many times a new thought will appear to take it's place and you repeat the process.
A comfortable sitting or resting position is the number one thing to help you to meditate. Music can help you to relax and keep you from dwelling on a thought for too long. A pleasant surrounding atmosphere is another big help. Many light candles and/or burn incense as they meditate. There are also many different types of guided meditations out there. Experiment with differnt things to see what works best for you.
Lastly don't be discouraged or become frustrated as you practice meditation. It takes time and practice to become skilled at it. Like others have said start with just a few minutes and work you way up to longer periods if you find yourself having trouble. Many Blessings.