[英]Check two timestamps with current date in PHP (Laravel)
我有两个时间戳记开始日期和结束日期,我需要与当前时间进行比较。
我想做这样的事情:
$discount_db = Discount::whereActive(1)
->where('starting_date', '<=', $curdate)
->where('ending_date', '>=', $curdate)
->first();
我想检查这个变量。 我有一个如果要检查时间戳记,命令和其他信息的地方。
使用碳
$curdate = Carbon::now();
$discount_db = Discount::whereActive(1)
->where('starting_date', '<=', $curdate)
->where('ending_date', '>=', $curdate)
->first();
if(count($discount_db)){
//something happen here
}else{
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.