Author: C. Manognan
DobAgeCalc is a versatile Java-based console application designed to calculate either a person's age based on their date of birth (DOB) or their date of birth based on a given age. The application supports multiple date formats and custom delimiters, offering flexibility for various use cases.
-
Age Calculation
- Input a Date of Birth (DOB) and a reference date (today's date or a custom date).
- The program calculates the age in years, months, and days.
-
Date of Birth Calculation
- Input an age and a reference date.
- The program calculates the date of birth.
-
Flexible Input Formats
- Supports different date formats:
YYYY-MM-DD
(International)DD-MM-YYYY
(Indian)MM-DD-YYYY
(USA)
- Accepts custom delimiters like
-
,/
, or.
.
- Supports different date formats:
- Clone this repository to your local machine:
git clone https://github.com/Manognan2046/DobAgeCalc.git
- Navigate to the project directory:
cd DobAgeCalc
Open the project in your preferred Java IDE (e.g., IntelliJ IDEA, Eclipse) or compile and run the program via command line:
javac DobAgeCalc.java
java DobAgeCalc
-
Date Formats Supported:
- YYYY-MM-DD (International)
- DD-MM-YYYY (Indian)
- MM-DD-YYYY (USA)
-
Delimiter Choices:
- -, /, .
-
Operation Types:
- DOB=: Enter a date to calculate the age.
- AGE=: Enter an age to calculate the DOB.
-
Reference Date:
- Enter a specific reference date or type TODAY to use the current date.
- Run the application and follow the prompts.
- The program will ask for:
- DOB or AGE: Specify the type of input, either Date of Birth (DOB=YYYY-MM-DD) or Age (AGE=00YY-MM-DD).
- Reference Date: Either choose today's date or input a custom reference date in the specified format.
- Date Format: Enter the format (e.g., YYYY-MM-DD).
- Delimiter: Specify the delimiter used in the date (e.g., -, /, or .).
Input:
DOB=2000-01-15
- Do you want to take reference date as today?(y/n):
y
- Enter today's date:
2024-11-16
- Reference Date:
2024-01-01
- Date Format:
YYYY-MM-DD
- Delimiter:
-
Output:
Your age is (DD, MM, YYYY): 17 days, 11 months, 23 years.
Input:
AGE=23-11-17
- Enter today's date:
2024-11-16
- Date Format:
YYYY-MM-DD
- Delimiter:
-
Output:
Your DOB is on (DD, MM, YYYY): 15-01-2000.
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes with meaningful commit messages.
- Push the changes and create a pull request.