The Ghost meets Hamlet on the battlements in Act I, Scene Four and prods Hamlet to avenge his murder by Claudius, his brother and Hamlet's uncle.
William Was Murdered !
I think he was afraid Hamlet was going to find out that Claudius killed Hamlet's father.
His brother, Claudius, came out into the garden while King Hamlet was sleeping and poured poison into his ear.
Hamlet is suicidal because his father, who was very dear to him, had just been murdered by Hamlet's uncle, Claudius. Within two short months of his father's murder, Hamlet's mother, Gertrude then married that very same Claudius. This is the main reason as to Hamlet's suicidal tendancies but he is also very mixed up in his head due to encounters with his father's ghost.
Horatio is Hamlet's friend from university. He tells Hamlet that his father's ghost has been seen wandering the castle walls.
Hamlet sees his father's ghost in the play telling him he was murdered and the ghost returns several times in the play. Shakespeare liked to use the supernatural in his plays with ghosts, witches, and other beings. Many times these characters foreshadow events or set events into action.
Horatio was brought to Elsinore by the ghost of Hamlet's father, King Hamlet, who appeared to him and two of his fellow soldiers while they were on watch. Horatio was called by the ghost to tell Prince Hamlet that the ghost was his father and that he had been murdered by his brother, Claudius. Horatio was then tasked with convincing Hamlet that the ghost was telling the truth. Once Horatio had told the prince what the ghost had said, he suggested that Hamlet should act as if he were insane in order to ensure his safety and to help him uncover the truth of his father's death. Horatio also advised Hamlet to feign madness and use it to his advantage to find out the truth about his father's death. He also suggested that Hamlet should not act too hastily as he could be putting himself in danger if he made the wrong choices.
Hamlet does not reveal much to these two. They go to him in order to find out about where Polonius has been buried, but they do not get many answers.
Not long. A couple months, tops.
The ghost says that he is stuck in purgatory because he did not have a chance to confess before he died. It would have been less cruel to have killed him as he stepped out of the confessional, but give Claudius some credit here--he's not going to kill Hamlet in such a way that Claudius was going to get caught. Claudius might have chosen a less nasty poison, one supposes. That would have been less cruel.
Hamlet doubts the ghost's statement that Claudius had murdered him--the ghost could be lying. He re-enacts the murder in a play and has it performed in front of Claudius. Sure enough, it causes an attack of conscience in Claudius.
Horatio finds Hamlet asleep in the middle of a dirt road.