Thank you for the nice question! Although similar to a bacteria, coronavirus is also a pathogen that makes us ill after infection, as a virus it is quite different from a bacteria. To be specific, a bacteria can self-sustain and replicate in a desired environment, while a virus needs to hijack the “factories” in the host (like us human beings) to be able to replicate and propagate. This is also why some clinicians recommend us not to use antibiotics in most times to treat common cold which is normally caused by virus– antibiotics can kill bacteria cells, targeting its life cycle, but they cannot perform any damage to viruses.
Coming back to your questions, the time each virus still remains infectious on a surface varies quite a lot depending on the type of virus and the environment surrounding the surface. For example, the HIV viruses generally lose its infectious ability less than a minute after it leaves an environment of body fluid. Speaking of the current Covid-19, scientists are still looking for more data to support exactly how long it may last. Reports suggest that it tends to be active for longer time in cool and humid environments. In the air or on wood surfaces, for example, it could stay infectious for hours. This is why it is very important to wash your hands thoroughly and frequently.