Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How to calculate age using query builder in laravel?

You can use selectRaw and then use mysql function like this

$user_info = DB::table('users')
                ->selectRaw("TIMESTAMPDIFF(YEAR, DATE(dob), current_date) AS age")
                ->get();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #calculate #age #query #builder
ADD COMMENT
Topic
Name
8+5 =