You should accept the answer that it helped you the most. Both the answers could say the same, but (for example) one could give some reference links, report a code snippet, or use a language that is clearer to you.
If you are not able to decide which one is better, you can base your decision on the votes given to both the answers, and choose the one that has been up-voted more times.
As you said that you logged in few hours later, I would rather wait before accepting any answer; it could be the answers are further up-voted, or somebody else can write an answer that is even better than the existing ones. There isn't a timeout for accepting an answer. I personally prefer to wait at least one day before accepting an answer; if the question didn't get enough answers in that period of time, I could also wait longer before accepting one.