Date / Time

What is the best way to store dates in the database?

What is the best to store times in the database?

How do I store the date now?

How do I store the time now?

How do I get it so that I can know whether the date now, is a month before a certain date?

How is this done? I need it because I am creating an application that needs to remind people of something a month before a certain date. So I need it so that it can check date A and see if its within a month before range of data B.

Which database type are you using?

If MySQL, then DATETIME is good

For reminders, you will probably want to run a CRON job nightly to call your yii page

then you’ll want to select (findAllBy or similar) all the records who’s date is exactly one month from now


Yeah, I am using MySQL. I will try what you have said.