First, the Cosmog thing is not a time-based event.
If you still can't get Cosmog, then read this carefully.
The answer to why Cosmog isn't appearing is because if Solgaleo/Lunala is at the front of your party and it's night if you're playing sun in-game or day if you're playing Moon in-game then use Charizard to fly over to the Ula'Ula meadow, and run to the right and you should find a shrine. When you get to the end of it then when you get to the end of it a cutscene with both of the legends will play then Cosmog will appear.
If you read that carefully, followed all the instructions, and still can't get Cosmog, then comment on my answer saying that you tried everything Espeon and I told you to try and nothing worked, and I'll hide my answer.