You are looking for the difference between the past perfect and the present pefect. Under your post are some links that will take you to posts that address this topic, or you could do a Google search on "present perfect" and see if those are helpful.
There have been so many discussions on this topic in these forums that you should be able to get many of your questions answered, but if you still have specific questions, please post again.
Simply, past perfect is the had + participle verson, and is used to talk about something that took place even further in the past than the main action in the past. Because John had forgotten his lunch, he was hungry all afternoon.
Present perfect is for something in the past that may continue into present, and is not used with a specific time reference.