Create Variable in PHP Equal to Current Time Minus One Hour

前端 未结 9 1304
青春惊慌失措
青春惊慌失措 2020-12-11 15:12

In PHP, how could I create a variable called $livetime that equals the current time minus 1 hour?

9条回答
  •  轮回少年
    2020-12-11 15:26

    Current time is equal to time() (current time given in seconds after Unix epoch).

    Thus, to calculate what you need, you need to perform calculation: time() - 60*60 (current time in seconds minus 60 minutes times 60 seconds).

    $time_you_need = time() - 60*60;
    

提交回复
热议问题