How can I compare datetimes?

I want to generate pdfs from my database, from tickets. This pdfs are
meant to be generated and saved every Friday at an specific hour. How
can I do that?