We are commanded to be our children's teachers. You shall teach them diligently to your children. They are after all our children. Our responsibility. The government would like to program us all into believing that a child's education is the governments responsibility but it isn't.
When to teach them ...... when you sit in your house, and when you walk by the way, and when you lie down, and when you rise. Basically all the time we are to be teaching and talking to our children about God.
How to teach them.... You shall teach them diligently to your children. We certainly cant teach our children the precepts of God if we are not even with them! Lets think about it like this. Could we as adults hang out with a group of people ....any group of people for 8 hours a day every day and not be influenced? No way! Our children are more easily influenced than we are. They will be molded by someone.
What to teach them.... Deut 6:4 "Hear, O Israel: The LORD our God, the LORD is one. 5You shall love the LORD your God with all your heart and with all your soul and with all your might. I think that this refers to the Oneness of God in contrast to the trinity but I also think it speaks to us about the sovereignty of God. We are to forsake idol gods. To teach our children that there it to be only One who sits on the throne of our hearts.
Notice the Bible doesn't say one thing about the necessity of worldly socialization here. Nothing about being able to relate to the world. In fact verse 20 instructs us parents to tell our children about how God delivered us out of Egypt! How can we do that if they are being taught by Egyptians? The Bible never even mentions academic education here. The teaching and learning going on here is about God. The love of God. The sovereignty of God. So much rich instruction on how to teach our own children to be found in His Word.