Rochester is a proper day out from Dartford, and it does not ask you to stay the night. The castle, the cathedral, and the high street sit in a walk you can do between trains. You are back for dinner if you want to be.
The train
Southeastern runs from Dartford toward the Medway towns. Check the return before you leave, including the last train you would still be happy to catch, and buy with that in mind. Rochester station is close enough to the centre that the day starts when you step off, not after a bus. If there is engineering work, read the whole notice. A rail replacement that adds forty minutes each way turns a day trip into a commute.
What to do with the hours
Walk up to the castle first, while your legs are fresh, and look at the river from the grounds. The cathedral is the quiet contrast, a few minutes away. The high street will try to feed you immediately. Eat once, properly, rather than grazing every shop. If you like a second-hand book or a small museum, they are there. You do not need a list. The town is small enough to cross and come back.
When to go home
Leave yourself a gap before the train you circled. Rochester rewards an unhurried afternoon and punishes a sprint from the castle to the platform. If the weather is good, sit by the river for twenty minutes and then go. That is a day from Dartford used well.