vendredi 20 novembre 2015

Laravel Get created_at in Millisecond Timestamp

In Laravel 5.1, I am trying to get the created_at date in millisecond timestamp to use in frontend javascript. How can I do that? My query at the moment is 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 of created_at to be like this: 1325356200000



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire