Less than 24 hours should be fine. I don't speak from experience, but I believe our old China hand, Moondog, has discussed it in previous posts in this section. Please do try a search and I am sure you will be able to find it.
I strongly recommend getting a hotel, putting your bags down and seeing some of the city, especially if its your first time. Feel free to PM me for ideas or look around this forum.