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

    How to change date format in jquery using moment JS ?

    How to change date format in jquery using moment JS ?

    Open Post

    PHP MySQL - Simple Image Gallery CRUD example from scratch

    PHP MySQL - Simple Image Gallery CRUD example from scratch

    Open Post

    Laravel 5 - Implementing datatables tutorial using yajra package

    Laravel 5 - Implementing datatables tutorial using yajra package

    Open Post

    PHP MySQL contact us form with validation using Bootstrap

    PHP MySQL contact us form with validation using Bootstrap

    Open Post

    Laravel 5.3 - whereDate(), whereMonth(), whereDay() and whereYear() examples.

    Laravel 5.3 - whereDate(), whereMonth(), whereDay() and whereYear() examples.

    Open Post

    Laravel 5 Google OAuth authentication using Socialite Package

    Laravel 5 Google OAuth authentication using Socialite Package

    Open Post