In Laravel 5.1, I'm trying to get a date created_atin a millisecond timestamp to use it in frontend javascript. How can i do this? My request at the moment looks something like this:
$stats = User::where('created_at', '>=', $range)
->groupBy('date')
->orderBy('date', 'DESC')
->get([
DB::raw('Date(created_at) as date'),
DB::raw('COUNT(*) as value')
])
->toJSON();
I want the output to created_atbe as follows:1325356200000
source
share