向当前时间/日期添加1小时的到期时间 [英] Add a 1-hour expiration to the current time/date

查看:165
本文介绍了向当前时间/日期添加1小时的到期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//expiration
$datetoday = date("F j, Y, G:i");

$expquery = mysql_query("SELECT a_expire FROM regform_admin WHERE status = 'Pending for payment'");
$row = mysql_fetch_array($expquery); 
$expirydate = $row['a_expire'];
echo "$datetoday";
echo "$expirydate";
if ($datetoday == $expirydate) {
    $expirequery = mysql_query("UPDATE regform_admin SET status = 'Expired' WHERE status = 'Pending'");
    $expirequery2 = mysql_query("UPDATE regform SET status = 'Expired' WHERE status = 'Pending'");
}
//end expiration

您好,我的预订代码已过期.我的问题是,如果客户在23:30进行预订,并且预订将在00:30(1小时)到期,那么我会输入以下代码:

Hi, I have an expiration of reservation code here. My problem is that if a customer makes a reservation on 23:30 and the reservation will expire at 00:30 (1 hour), I made this code:

$currentdate = date("F j, Y, G:i");  
$onehour = date("G") + 1;
$expire = date("F j, Y, $onehour:i");

$onehour必须递增,但是问题是23:30保留必须在24:30过期.但是在增加$ onehour之后,23:30的结果变为24:40.由于我的军事时间是凌晨12点,因此我的程序无法读取,该时间是00:00,而不是24:00.有人可以对我的问题提出建议吗?谢谢.对不起,懒惰的英语让我厌倦了思考

The $onehour must increment, but the problem is that the 23:30 reservation must expire at 24:30. But after incrementing the $onehour, the 23:30 results into 24:40. Which my program cannot read since military time of 12am is 00:00 and not 24:00. Can anyone have suggestions in my problem? Thanks. Sorry for the lazy english I was tired of thinking

推荐答案

$expire = date("F j, Y, H:i", strtotime('+1 hour'));

这篇关于向当前时间/日期添加1小时的到期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆