Tag : DATEDIFF()



How to calculate age from date of birth column in mysql?

Sometimes, we require to get age from birthdate using mysql select query, we can do it in programming like php,.net and etc framework but if we can do it using mysql query. In bellow example mysql query you can learn how to get age from date field. We can get age value from using mysql DATEDIFF(). So, let's see bellow query. <strong>Example:</strong> <pre> SELECT id, (DATEDIFF(CURRENT_DATE, STR_TO_DATE(born_date, '%Y-%m-%d'))/365) as age FROM `users` </pre>

By Hardik Savani | June 1, 2016 | | 4771 Viewer | Category : MySql
READ MORE

    Laravel 5 Localization(trans helper) tutorial example

    Laravel 5 Localization(trans helper) tutorial example

    Open Post

    Angularjs nl2br(textarea newline and linebreak conversion) example with demo

    Angularjs nl2br(textarea newline and linebreak conversion) example with demo

    Open Post

    PHP AngularJS CRUD with Search and Pagination Example From Scratch

    PHP AngularJS CRUD with Search and Pagination Example From Scratch

    Open Post

    Simple Tags System Example in Laravel 5

    Simple Tags System Example in Laravel 5

    Open Post

    How to remove # from URL in AngularJS?

    How to remove # from URL in AngularJS?

    Open Post

    AngularJS - simple image upload with preview example in PHP

    AngularJS - simple image upload with preview example in PHP

    Open Post