When was the Holy Spirit first given to the disciples?

John 7:39

Now this he said about the Spirit, whom those who believed in him were to receive, for as yet the Spirit had not been given, because Jesus was not yet glorified.

John 16:7

Nevertheless, I tell you the truth: it is to your advantage that I go away, for if I do not go away, the Helper will not come to you. But if I go, I will send him to you.

John 20:22

And when he had said this, he breathed on them and said to them, "Receive the Holy Spirit."

Acts 1:5

"...for John baptized with water, but you will be baptized with the Holy Spirit not many days from now."

The Holy Spirit worked through some believers prior to Jesus' life on Earth, as some leaders and prophets were filled with the Holy Spirit (e.g. Jdg 3:10, 1 Sam 16:13, Mk 12:36, 1 Pet 1:10-11, 2 Pet 1:21). In Jesus' time, John the Baptist was "filled with the Holy Spirit even from his mother's womb" (Lk 1:15), and both his parents prophesied through the Spirit (Lk 1:41, 1:67). However, these were specific individuals; the Spirit had not yet been given to all believers.

There are some distinct differences between the disciples receiving the Spirit in John 20:22 and their receiving the Spirit at Pentecost:

As for Jesus' declaration that the Spirit would not come to the disciples if Jesus didn't leave, this may have referred to Jesus' death and resurrection being a prerequisite for the prophecy of Joel 2 to be fulfilled (as mentioned in John 7:39, "...as yet the Spirit had not been given, because Jesus was not yet glorified"). (Incidentally, the giving of the Spirit in John 20:22 takes place after Jesus' resurrection.) Clearly Jesus didn't mean that his presence on Earth was incompatible with the Holy Spirit indwelling others, as John the Baptist was also filled with the Spirit as mentioned above.