The second sentence is grammatically correct.
We use simple past tense in these cases:
- Showing an action which started in past and ended in past, too
Example: I met him yesterday
- Referring to one's habit in the past
Example: He never drank coffee
- An action which happened in a certain period in past.
Example: He worked in the company for 2 years
- Referring to 2 actions that happened immediately after each other.
Example: When the teacher entered, they stood up.
We use present perfect tense in following cases:
- The action happened in the past but we see the effect of that action in present.
For example: I have lost my keys
Note: if the action does not have any effect till the present tense we can not use present perfect in this case we should use simple past tense.
Referring to an action which happened several times in the past.
Example: he has visited London 10 times.
An action which started in past but continues till present and may continue in future, too.
Example: He has been in the army for 2 years.
We have worked all day.
We can use this tense to show that an action has happened earlier than expected time (use "already" in this case)
Example: A) "don't forget to mail the letter"
B) I've already mailed them.
we can also use "since" with present perfect to talk about a period that started at some point in the past and continues until the present time
Note: the main difference between simple past and present perfect is that simple past expresses an event or action at a specific time while present perfect expresses an action at an indefinite time.
The first sentence, you wrote has problem according to my explanations
References: Advanced English Grammar in Use by Martin Hewings, English Grammar Digest by Trudy Aronson.
practical English grammarby S.Anari