如何在 Laravel 中以 unix 时间戳保存日期?

Tru*_*pti 7 php date laravel

我有一列为 close_date,数据类型为时间戳。我想在 unix 时间戳中添加日期,例如 1556801668。我不知道如何在 Laravel 中做到这一点。

Tha*_*han 6

使用phpstrtotime()函数转换时间。

例子

$time = '2019-01-01'

$timeStamp = strtotime($time);

// will output 1546300800
Run Code Online (Sandbox Code Playgroud)