That all depends on where you are in your project. As a graduate student, I sometimes find it amusing how some undergrads walk into labs and announce that they want to get published when the summer ends or even at the end of a year. I'm not saying this is you or anyone else but I've seen this happen many times. It takes much, much more than that unless you get really lucky and/or you're walking in on the tail end of a project the PI puts you on. Even graduate students generally don't push out papers until their 2-3 years (partly because of having to take classes, partly because projects just take time to develop and carry out). Since I don't know which category you fall in, I'll give you advice for both cases.
If you have a project that is nearing completion, then it's definitely acceptable to ask your PI if he/she thinks it's publishable or publication-quality work. That's a frank conversation you should have before continuing mindlessly on the project because if your PI isn't going to publish it anyway, it may just become a waste of resources and your time. If you're working alone on this project, you will likely have to draft a manuscript and that will take some time so keep that in mind when you talk to him/her so that you know what will be expected of you if your PI thinks your work is publication quality. If you're working with someone else in the lab on the project as is common with undergrads, then you should ask the post-doc or graduate student you're working with for their opinion. That's probably best case scenario for you because grad students and post-docs very rarely want to work on dead end projects and if they're still working on it, they probably believe it's publication quality.
If you don't yet have a project but want to get published, you should talk to your PI about putting you on a project with a grad student or post-doc. If you want to take greater initiative, do a review of the literature in your sub-field and bring a proposal to your PI. Make sure beforehand that the proposal would be welcome though, because you don't want to waste all that time thinking about it for nothing.
In the end, how long a project takes will depend on your field. In biology, many projects generally take very long to do because biological systems are messy and you may have to acquire/create an animal model, cultures, etc. On the flip side, biology projects can more easily be designed so that negative results are still publishable. For example, say there is compelling evidence that A should be in a cancer pathway and probably is responsible for X. Say you do the experiment and A is actually in the pathway. Bam. Paper. Say you do the experiment and A is not in the pathway. However, based on all available evidence, A should be in the pathway because X is known to be caused by A. Well, now you have a result you can work with. If X is known to be caused by A but now you've found a system where it's not caused by A, that's a good result. You can even go on to screen for the culprit for X in your system.
In general, papers take even longer to come out if you're looking at high-impact journals like Nature or Science. For these journals, the highest quality work is demanded and so a lot of your time will be spent doing positive/negative controls, follow-up experiments, etc. Peer review also takes awhile, as the reviewers will likely have a lot to say about your paper and you'll have to go back and do the follow-up experiments before they let your paper through. And sometimes, there's that reviewer who just won't let your paper through and you have to repeat the process at another journal. All this takes a lot of time and so that's another reason why publications take so long to put together.