MySQL - 处理列表的到期日期

I'm creating listings and I wanted some suggestions on how to deal with expiration dates.

I'd like to be able to:

  • pause a listing and resume it (moving expiration time forward on resume)
  • have a flexible expiration (normally 30 days but I'd like to set something else if needed)

Questions:

  • how should I store this information? (datetime?)
  • how do I calculate paused time to move time forward on resume (store it?)
  • do I need a start time or just the end time? (I'd like to be able to approve a listing beforehand, so time would start later than row insertion)
  • what sort of problems might I encounter?

I'd appreciate some input and suggestion on how to achieve this.

I would suggest a few fields

start time - DateTime
duration - Int
pause time - DateTime

This way, if they pause it, you store a time, then when they unpause it, you can add however many seconds have passed since they paused it to the duration. With this setup, you can do a simple query that adds duration to the start date to see what has expired.

You could also make this simpler, but less precise, by simply using date fields, and having duration be a number of days instead of seconds.