Fetch strtotime data as time format with am and pm
Hi, I have a table with the columns start time and end time and it doesn't have any date. I have converted time to strtotime and Stored in a database. Now I want to know how to fetch time record in time format with am and pm using Db raw query or using any other way. Please guide me. I am not storing datetime here just storing time because this time data remains constant for all days. Ex : time: 10:00 AM converted to strtotime and storing in the database. I am using angularjs ng-repeat to display data in blade file.
From what I understand is that you first parse a string like "10:00 AM" using strtotime(), which converts it into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 GMT).
To (re)convert this timestamp into a readable time you would use the date() function in PHP.
// Look up the model (in this case a simple query)
$model = Model::first();
// fetch the timestamp from your database for the specific model
$unixTimestamp = $model->start_time;
// returns the time in 12h format
$date = date('H:i A', $unixTimestamp)
@johnbraun this can be done when we use laravel foreach to display data in blade file but i am using angularjs ng-repeat to display data in blade table.