Whether or not you can actually do this depends on your profession, your company's policies, and how timely your work is. The standard 9-to-5 isn't for everyone and if you're working on projects that don't adhere to those hours, there's no reason you should have to either.
Maybe you're a morning person and love getting up at 6 a.m. and cracking on with the day's tasks bright and early. Or, maybe you're a night owl who works best in the later hours of the day. I'm the former and thankfully, my boss doesn't seem to mind. As long as my work's done that day, it doesn't matter what time it happens. If you can swing this, it will make you way more productive.