$createdTime = Carbon::parse($specialist->created_at)
->diff(Carbon::now())
->format('%y yr, %m mo and %d days');
这将返回0 yr, 0 mo and 8 days。我只想返回8 days。
如果是1 yr, 0 mo and 8 days,则返回1 yr and 8 days
我尝试访问存储在db表中的日期,并将其与当前日期进行比较,以便获得天数,但它显示了此错误。
DateTime::__construct(): Failed to parse time string ([{"quit_date":null},{"quit_date":null}]) at position 0 ([): Unexpected character
这是在我的控制器中使用的代码
$quit_date = Information::select('quit_date')
-
我要计算2排之间的时间和计算等级。这是我的密码:
public function testtima($sid,$rid){
$calcs=users::where([['si',$sid]])->first();
$calcr=users::where([['ri',$rid]])->first();
$stime=$calcs['created_at'];
$rtime=$calcr['created_at'];
$show['
在这里,我需要检查一下我的应用程序中的物品是否是实时拍卖的,所以我在文章模型中写到:
public function scopeCloseauction($query){
$query->where(Carbon::parse('to')->subDays('auction_end'),'>',Carbon::now());
}
我的看法是:
@if ($article->Closeauction())
<td>
控制器
static function show()
{
//
$output = '';
$result = DB::table('PersonalDetail')
->get();
foreach ($result as $key ) {
$dob = Carbon::$key->DOB;
// We need to compare the user's date of birth with today's date.
$no
我正在使用Laravel5.2,我想展示文章的创作时间如下:
created_at displaying
in 1 day today
2-10 days (2-10) days ago
>10 days show creation date directly
该怎么做呢?
提前感谢!
编辑:
主计长:
public functi
我需要从模型用户中选择具有特定年龄的用户,但出现以下错误:
DateTime::__construct(): Failed to parse time string (birth) at position 0 (b): The timezone could not be found in the database
控制器的一部分:
$users = User::where(Carbon::parse('birth')->diff(Carbon::now())->format('%y'), '>=', 18)->get()
我正在做一个项目,在那里我需要导出Excel格式的产品销售报告。我正在使用
我有三个模特。
product.php
class products extends Model
{
protected $table='products';
public $timestamps = false;
protected $fillable = ['image', 'asin','price','strategy_id'];
public function orderDetails()