当前位置: 动力学知识库 > 问答 > 编程问答 >

time - How can I check request day with php?

问题描述:

For example: x user booking ticket on monday and ticket status changing as book. After three days, ticket status will change as free(empty) automatically. How can I do this?

网友答案:

Try something like this (using strtotime):

if ($ticket_timestamp < strtotime("-3 days")) {
  // ticket is expired
}
网友答案:

You will usually want to check this by date. If you don't care about the actual date but just need to compare, you can use the time() function. The day is time()/60/60/24 .

You can store the timestamp of the order in the database and then compare it with the current time.

分享给朋友:
您可能感兴趣的文章:
随机阅读: