Вопрос

Just a quickie,

I have a date in my database where a subscription to a service starts...

In your experience, do you think it's better to record the expiration period as a time.. so then i can add the time onto the date_created to see if it has expired... Or shall I just workout the date it will end in php and put that into a datetime in the database?

So, TIME or DATETIME for subscription length.

Ask me if you want more details.

Это было полезно?

Решение

I would use the end date, this way you only need to make one calculation when you add the record to your database. Every other time you can just compare the current date to the expiration date.

Другие советы

I'd be tempted to save the start date, as if you're storing the expiration date only and you want to change the subscription length from say, one month to three months, you've got to try and work out the original start date and then add your new subscription length back on.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top