Now in the fourth year of King Darius it came to pass that the word of the Lord came to Zechariah, on the fourth day of the ninth month, Chislev, 2 when the people sent Sherezer, with Regem-Melech and his men, to the house of God, to pray before the Lord, 3 and to ask the priests who were in the house of the Lord of hosts, and the prophets, saying, “Should I weep in the fifth month and fast as I have done for so many years?”
4Then the word of the Lord of hosts came to me, saying, 5“Say to all the people of the land, and to the priests: ‘When you fasted and mourned in the fifth and seventh months during those seventy years, did you really fast for Me—for Me? (Zechariah 7:1-5)
Obedience is better than ritual fasting. This is not to negate fasting. Having said that, one can fast and yet live in rebellion against the Lord and His Word
The word of the LORD came to Zechariah concerning 7 things that they needed to do: (Zechariah 7:8-10)
1. Execute true justice,
2. Show mercy and compassion everyone to his brother.
3. Do not oppress the widow
4. Do not oppress the fatherless,
5. Do not oppress the alien
6. Do not oppress the poor
7. Let none of you plan evil in his heart against his brother.’
They made their hearts as hard as stone, so they could not hear the instructions or the messages that the Lord of Heaven’s Armies had sent them by his Spirit through the earlier prophets. That is why the Lord of Heaven’s Armies was so angry with them. (Zechariah 7:12 NLT)
Hardening your heart will cause you not to hear the instruction of the Lord. If you hear His voice do not harden your heart as in the days of rebellion
Therefore it happened, that just as He proclaimed and they would not hear, so they called out and I would not listen,” says the Lord of hosts. (Zechariah 7:13)
One of the major hindrances to prayer is not listening and doing the word of God. If one turns away his ear from hearing the law, even his prayer is an abomination. (Proverbs 28:9)