Storing time strings to TIME column in Laravel Storing time strings to TIME column in Laravel laravel laravel

Storing time strings to TIME column in Laravel


Use PHP strtotime() function.

$time = "12:00am";$timestamp = strtotime($time);echo $timestamp;//Will print something like: 1469228400

Or any other date format you prefer.

It's best to store time as timestamp, to convert it back you can use date() function.E.g: $value = date("H:i:s", $timestamp);