My created_at and updated_at column is inserted in UTC timezone. Now I want to show the data according to "america/chicago" timezone. I am using the Carbon library to get the result.
Below is the code I have written to fetch the information from database.
public function getAllUsers(){
$users = BaseUserModel::
select('id', 'email', 'created_at')
->whereDate(
'created_at',
'=',
Carbon::today('america/chicago')
)
->orderBy('created_at', 'desc')
->limit(5)->get();
return $users;
}
Attached database entry with UTC time. Now when I am trying to execute the query, getting only one output(2018-10-03 15:27:18). But my expected output should come both date in "america/timezone".
See the difference of UTC and America/Chicago timezone. https://www.worldtimebuddy.com/
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire