Today, we will learn to calculate age from birthdate in laravel application. we will use carbon to calculate age in laravel.
Actually, yesterday i was working on my laravel 5 application and i require to display age from date of birth in laravel project. I thought i need to use date helper function on php. but i found carbon to calculate age in laravel and we don't require to install carbon in laravel because it is already installed.
So, here is a very simple example for age calculation in laravel.
$myDate = '1995-07-02';
$years = \Carbon::parse($myDate)->age;
I hope you found your best...
Do you like below Tutorials ?
- Angular Multiple Image Upload Example | Multiple Image Upload in Angular 9
- Angular File Upload Example | File Upload in Angular 9
- Angular Multiple File Upload Example | Multiple File Upload in Angular 9
- Laravel install Bootstrap 4 Example
- Laravel Install React JS Example
- Laravel Install Vue JS Example
- Laravel Authentication Example | Laravel Auth Example
- Angular 9 Service Example | Create Service in Angular