Which one is correct and why?
"My friend hasn't been in church in two weeks."
"My friend hadn't been in church in two weeks."
These sentences make it difficult to know the difference between has, have and had.
Hasn't been - the Present Perfect
"My friend hasn't been in church in two weeks"
This means that your friend hasn't been in church in the last two weeks. The last time your friend was in church was two weeks ago, and they haven't been to church since then (to the best of your knowledge).
Hadn't been - the Past Perfect
"My friend hadn't been in church in two weeks"
You are describing the past. There are various possible ways this could fit into a narrative, and the period described might be in the distant past or in the very recent or immediate past. Compare these examples:
Furthermore, although the two-week period is in the past, the construction doesn't by itself tell us whether the friend subsequently returns to church (for example, sentence (a) above leaves open the possibility that she never returns at all) or whether the period of her absence has come to an end (as in (b)).
Both of these are correct, idiomatic English. A native English speaker might use either of them. But they would only use the one that fits the situation, because they do not mean the same thing.
My friend hasn’t been in church in two weeks.
This means that between 14 days ago and today, your friend hasn’t been in church. Assuming this church is the Christian kind, that means your friend has missed church on both the most recent Sunday as well as the Sunday before that.
It can’t really refer to any other period of time. Using this sentence when discussing a past event, and referring to the two-week period prior to that event, would be wrong.
My friend hadn’t been in church in two weeks.
There was some 14-day span of absence from church immediately prior to whatever else you are talking about.
So, for example, if you were saying “It was January 1, 1970. My friend hadn’t been in church in two weeks,” then that friend was not in the church for Sunday Mass on December 21 or 28, 1969, nor for a Christmas Mass on December 25, 1969, or at any other time since at least December 18, 1969.
The statement says nothing about their church attendance in a more recent time period. And if you haven’t established what past time period you’re discussing, using “had” here would make little sense.
That is the primary difference between “has” and “had” as auxiliary verbs:
“has” refers to something prior to the present, when discussing the present.
“had” refers to something prior to the past, when discussing some past event.
Sometimes, English speakers will use the present tense even when describing past events. This is fairly common in storytelling, for example. Many feel that it makes the story stronger, “pulls the listener into the story” by making it feel like they’re back in the past, in the middle of the story. So it’s plausible to say “It is January 1, 1970. My friend hasn’t been in church in two weeks.” Grammatically, both are in the present tense, even though we’re talking about events of more than fifty years ago. That’s because we’re pretending, for the sake of the story, that it is January 1, 1970, not fifty years later. And those sentences, in that tense, would have been entirely reasonable if the speaker were speaking on January 1, 1970.
When you use the past perfect (eg had been) you are always, without exception, choosing to describe past events or situations from the viewpoint of a more recent time, but still in the past.
In most cases, you have a free choice of whether to view the events from that later point or not; i.e. you can use the past perfect or the simple past: the difference is not in the objective events, or the sequence, but simply in the temporal viewpoint you choose. The time of the viewpoint has usually already been established in the discourse; so starting a conversation My friend hadn't been in church for two weeks is odd, unless there is some reason why you expect your hearers to know the point in time from which you are choosing to view your friends absence.
The present perfect (has been) is choosing to refer to events or situations in the past which have some present relevance. The exact meaning of that present relevance can vary quite a lot; but when it refers to something over a period of time, as here ("in two weeks") it usually means that the period extends up to the present.
My friend hasn't been in church for two weeks.
during the last two weeks, up to today.
My friend wasn't in church for two weeks.
during a two-week period that ended before today: it could have been recent or long ago.
My friend hadn't been in church for two weeks.
during a two week period leading up to some point of time that you have probably already been talking about.
The second and third might be referring to the exact same events, the difference being in whether you are choosing to view them from a particular point of time.
This is the Present Perfect tense. This tense is normally used to refer to an action that began in the past and continues to the present. Consequently, the non-attendance could continue indefinitely. Next week the friend could go to church or not, the reader does not know.
This is the Past Perfect tense. It is used to refer to a previous action that occurred in the past. Unless more context is provided, the reader will infer that the action was completed in the past. For example, the reason for not going to church was an illness, once recovered, the churchgoer resumed regular church activities.
Among those who typically attend religious services at least monthly, one-third say they have done so in person during the last month [July 2020], and nearly three-quarters (72%) say they have watched religious services online or on TV.
Since the pandemic, seven in ten people interviewed have watched church services online or on TV while one in three have attended church services. This suggests that churchgoers will continue to attend in person, although anything could happen between now and the end of 2020…
From the same survey, the Past Perfect is used only once. Why? Because the article, posted in August 7, 2020 is referring to a recent survey that was taken July 13-19, 2020, so it is focused on the present.
Among those who have recently watched religious services online or on TV, majorities of Catholics (68%) and mainline Protestants (62%) say watching virtual church services has been a new experience for them as a result of the outbreak, while most people in the historically Black Protestant tradition (59%) and half of evangelical Protestants say they had done this before.
The majority of Black Protestants and 50% of evangelical Protestants had already watched church services on television or online before the coronavirus outbreak.
I think the other answers here are good, but want to give a really clear explanation of the use cases, as I think people (even native speakers!) get this wrong a lot.
You would say
My friend hasn't been to church in two weeks
in most instances, because you usually talk about the present. This means, "Right now, the status is that my friend hasn't been to church in two weeks." Most conversations take place discussing current state, so this is the more common usage.
The only time in common usage you would say
My friend hadn't been to church in two weeks
Was if you had as a subject another event, which placed the time in the past. An example that might be reasonably common:
I saw my friend at church yesterday! She hadn't been to church in two weeks, so it was nice to see her.
The prior sentence establishes the timepoint you are discussing - yesterday - and thus hadn't is correct, since it is no longer true.
Of course, there's another possibility, which I think is where this often gets confusing.
My friend wasn't at church yesterday. She hasn't been to church in two weeks!
In normal speech, this is now using hasn't, because it's still the case in the present. Since you're speaking for the most part in the present tense, you still use present perfect here. You're not conveying only the information that she hadn't been at church between [two weeks ago] and [yesterday], you're stating that she still hasn't been at church. However, in a book, you'd more often see
My friend wasn't at church yesterday. She hadn't been to church in two weeks!
because books are usually written in the past tense. Even though they're saying exactly the same thing, the tense of the rest of the conversation affects which one you'd see.