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 | | 927 Viewer | Category : MySql
READ MORE

    PHP - How to implement Google new reCAPTCHA Code Example with Demo?

    PHP - How to implement Google new reCAPTCHA Code Example with Demo?

    Open Post

    How to use login throttle in laravel 5?

    How to use login throttle in laravel 5?

    Open Post

    Laravel 5 - Image Upload and Resize Example using Intervention Image Package

    Laravel 5 - Image Upload and Resize Example using Intervention Image Package

    Open Post

    Simple PHP Jquery Ajax CRUD(insert update delete) tutorial example with source code

    Simple PHP Jquery Ajax CRUD(insert update delete) tutorial example with source code

    Open Post

    iOS 7 style switches for checkboxes example using switchery JS

    iOS 7 style switches for checkboxes example using switchery JS

    Open Post

    Laravel 5 - "syntax error or access violation 1055 in group by" Solved

    Laravel 5 - "syntax error or access violation 1055 in group by" Solved

    Open Post