laravel - 没有给出完美的结果
问题描述
时间和日期都是不同的字段,但是当我使用这个编码时,结果并不完美。
这是我的代码:
$challenges = Challenge::whereDate('c_date','>',Carbon::now())->get();
Challenge::whereTime('c_time','>',Carbon::now())->get();
这段代码有问题吗?
解决方案
Firstly check the formate of date in c_date.Format should be ('Y-m-d').If your formate is okay then check your logic that what you really want? I think your fault is your logic .You want to get those date where c_date is grater then now date.
$challenges = Challenge::whereDate('c_date','<',Carbon::now())->get();
推荐阅读
- java - Android Studio 使用相同的密钥构建所有捆绑包
- r - 如何预测 xgboost 二元选择模型的准确性?
- java - 如何从不同的时区获取原始日期时间
- javascript - 当我单击导航栏按钮时,我的搜索栏宽度正在改变
- java - 为什么我的水平回收视图不会在片段中滚动
- java - 从列表中删除重复条目并保留最后更新的条目 LocalDate
- python - 如何为 scipy.odr 绘制 1-Sigma 预测区间
- javascript - 变量“数据”在声明之前如何访问?
- r - R Data.Table 按列名称重塑
- python - 在列表理解python之后使用方括号是什么意思?