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 ?
- How to Open URL in New Tab using Jquery?
- Laravel 7.x and 6.x Routing Tutorial
- Ng Bootstrap Modal in Angular 8 Example
- Bootstrap 4 Datepicker in Angular 9/8 Example
- Disable Registration Route in Laravel
- Bootstrap Timepicker in Angular Example
- Count Number of Pages in PDF - PHP Script
- Digital Signature PHP Script Example