It had started in the Vedic time in India.
The ‘zero’, the ‘seven days’ and the ‘twelve months’ were first given here in India.
Then Egypt copied it from India and from there it went all over the world.
In India there are seven major planets. Though we have nine planets, two of them are shadow planets of the moon that don’t exist.
So for each planet one day was given. For the shadow planets they allotted one and half hours of time every day instead of allotting them one whole day, so it fitted very well with the cosmic calendar. That is how we have Rahu Kaal and Gulik Kaal.
They formed the connection between the microcosm and the macrocosm. And they said the Earth completes one circle around the Sun in twelve months and then they divided it.
This was done some thirty to forty thousand years ago or may be even more. Nobody knows.