(Matthew 12:38-42)  Then certain of the scribes and of the Pharisees answered, saying, Master, we would see a sign from thee.  But he answered and said unto them, An evil and adulterous generation seeketh after a sign; and there shall no sign be given to it, but the sign of the prophet Jonas:  For as Jonas was three days and three nights in the whale’s belly; so shall the Son of man be three days and three nights in the heart of the earth.  The men of Nineveh shall rise in judgment with this generation, and shall condemn it: because they repented at the preaching of Jonas; and, behold, a greater than Jonas is here.  The queen of the south shall rise up in the judgment with this generation, and shall condemn it: for she came from the uttermost parts of the earth to hear the wisdom of Solomon; and, behold, a greater than Solomon is here.
One method is called “Inclusive Reckoning”. Here we accept that when counting days in new testament times, any part of a day was counted as a whole day. The Romans of the time counted inclusively. The day after tomorrow was three days, including today. Using this method, where it says after three days, or on the third day, if Yeshua was put to death on Friday and rose on Sunday, it was considered three days. Among scripture that could support this could be Matthew 20:1-16 (The Parable of the “Workers in the Vineyard”). There are ten instances of “on the third day”, five instances of “in three days” and two instances of “after three days” in the New Testament scriptures. There is only Matthew 12:40 that uses the phrase “three days and three nights”. If we are to hold a literal “three days and three nights” then the math does not work. Yeshua died Friday before sundown counted as one day. Remained in the tomb Saturday, second day, but was raised from the dead Sunday morning before the sun rose.
(John 20:1) The first day of the week cometh Mary Magdalene early, when it was yet dark, unto the sepulchre, and seeth the stone taken away from the sepulchre.
Counting Friday night and Saturday night equals only two nights.
The next method of reconciling this verse is to say that the “Heart of the Earth” is not necessarily the tomb but is when Yeshua is outside the protection of the Father or subject to the powers of this world. When He was not subject to this world, He could evade crowds who would have stoned Him. Some examples:
(John 8:59) Then took they up stones to cast at him: but Jesus hid himself, and went out of the temple, going through the midst of them, and so passed by.
(Luke 4:29-30)  And rose up, and thrust him out of the city, and led him unto the brow of the hill whereon their city was built, that they might cast him down headlong.  But he passing through the midst of them went his way,
But in the Garden of Gethsemane He relinquished that protection.
(Matthew 26:52-53)  Then said Jesus unto him, Put up again thy sword into his place: for all they that take the sword shall perish with the sword.  Thinkest thou that I cannot now pray to my Father, and he shall presently give me more than twelve legions of angels?
Another method is to say that Yeshua was crucified on Wednesday. Here is how this works. There are two years in the range of the possible crucifixion dates that Passover falls on a Wednesday night. Holidays such as Passover are also called “sabbaths in the scriptures”. So if Yeshua was crucified on Wednesday before sundown, we have Thursday, Friday and Saturday in the “Heart of the Earth”. Yeshua died before the Shabbat (Passover) came in. If He had not, the centurions would have made sure He did as they did with the convicts next to Him. Because the Shabbat was so imminent, they were not able to bury Yeshua. He was put in a rich man’s tomb temporarily. The women came to the tomb early on the first day of the week prepared to properly anoint Him for burial. The shortcomings of this method are that:
1) You would not go into a tomb four days after putting a dead body in there. As Martha said to Yeshua:
(John 11:39) Jesus said, Take ye away the stone. Martha, the sister of him that was dead, saith unto him, Lord, by this time he stinketh: for he hath been dead four days.
2) If Thursday was Passover and Saturday was the Shabbat, why not go on Friday?
The last method I will discuss is called interpolation. Basically it says that that verse was added later by scribes. If you take out the verse, then the passage makes sense. The sign of Jonas was that at his preaching, the people repented, in this case Ninevites who were gentiles. Reinforced by the next verse about the Queen of Sheba, also a gentile. Now the passage jives with Luke’s account which does not mention Jonas in the whale or Yeshua in the grave:
(Luke 11:29-32)  And when the people were gathered thick together, he began to say, This is an evil generation: they seek a sign; and there shall no sign be given it, but the sign of Jonas the prophet.  For as Jonas was a sign unto the Ninevites, so shall also the Son of man be to this generation.  The queen of the south shall rise up in the judgment with the men of this generation, and condemn them: for she came from the utmost parts of the earth to hear the wisdom of Solomon; and, behold, a greater than Solomon is here.  The men of Nineve shall rise up in the judgment with this generation, and shall condemn it: for they repented at the preaching of Jonas; and, behold, a greater than Jonas is here.
Matthew 12:40 has sometimes been regarded as a post-Matthean Interpolation by a number of scholars even though no ancient text is missing the verse. The only hint to it being a later addition is that Justin Martyr quotes the passage in Dialogue with Trypho 107:1-1 without the reference to 12:40.
These methods of dealing with Matthew 12:40 are all great for an enjoyable discussion. Anyone holding any of these views are entitled to their opinion. They are all valid arguments that cannot be rejected outright. Whatever position you hold, do the research and know why you hold to that persuasion.