문제

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