Severity: Warning
Message: fopen(/tmp/ci_session7974l1tl9qsbekeq18ht5t6hudu36tut): failed to open stream: No space left on device
Filename: drivers/Session_files_driver.php
Line Number: 176
Backtrace:
File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct
File: /var/www/html/index.php
Line: 311
Function: require_once
Severity: Warning
Message: session_start(): Failed to read session data: user (path: /tmp)
Filename: Session/Session.php
Line Number: 143
Backtrace:
File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct
File: /var/www/html/index.php
Line: 311
Function: require_once
Age calculator estimates the age of a person from the Date of birth using LocalDate objects, period class, and between() method.
This program is used to calculate the age of a person from the date of birth using LocalDate objects, two dates being first the date of birth and the second contemporary date.
Period class is used in java. time package which gets the difference between two LocalDate objects.
between() method is used which accepts two LocalDate objects and finds out the difference between two dates.
steps to calculate age from Date of birth:
1. Inputting date of birth.
2. using LocalDate object to convert it into local date
3. Writing Contemporary date.
4 using between() method as follows:
int years= Period.between(birthDate,today).getYears();
Submitted by Khushboo Jagwani (Khush123)
Download packets of source code on Coders Packet
Comments