Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

AGE CALCULATOR

1. INTRODUCTION

 What is Function?

PHP functions are similar to other programming languages. A function is a piece of code
which takes one more input in the form of parameter and does some processing and returns a
value. It’s very easy to create your own PHP function.

 What is the Purpose of making Age Calculator?


Age Calculator is an android app developed for the purpose of calculating
exact age of user. The application woks on any android devices fulfilling the basic
requirement of app. It mainly focuses at determination of exact age of user depending
upon the input date of birth.

What is the used of Age Calculator?


The Age Calculator can determine the age or interval between two dates. The
calculated age will be displayed in years, months and days. The age of a person can be
counted differently in different cultures. This calculator is based on the most
common age system.

G.P.KHAMGAON Page 1
AGE CALCULATOR

 Functions used in projects:

The PHP Date () Function-

The PHP date () function formats a timestamp to a more readable date and time.

Syntax:

Date (format, timestamp)

Get a Date

The required format parameter of the date () function specifies how to format the date (or time).

Here are some characters that are commonly used for dates:

 d - Represents the day of the month (01 to 31)


 m - Represents a month (01 to 12)
 Y - Represents a year (in four digits)
 l (lowercase 'L') - Represents the day of the week

Other characters, like"/", ".", or "-" can also be inserted between the characters to add additional
formatting.

The example below formats today's date in three different ways:

Example:

<?php

echo "Today is " . date("Y/m/d") . "<br>";

echo "Today is " . date("Y.m.d") . "<br>";

echo "Today is " . date("Y-m-d") . "<br>";

echo "Today is " . date("l");

?>

G.P.KHAMGAON Page 2
AGE CALCULATOR

2. REQUIREMENTS

 software requirements
1. Xampp Server
2. Notepad++

 Hardware Requirements
1. Computer system
2. Ram 2GB above
3. Hard Disk 500

G.P.KHAMGAON Page 3
AGE CALCULATOR

3. TECHNOLOGIES USED

1. PHP

2. HTML

3. CSS

G.P.KHAMGAON Page 4
AGE CALCULATOR

1. PHP

 PHP is an acronym for "PHP: Hypertext Preprocessor"


 PHP is a widely-used, open source scripting language
 PHP scripts are executed on the server
 PHP is free to download and use

 What is PHP used for?

PHP is a server side scripting language. That is used to develop Static websites or
Dynamic websites or Web applications. PHP stands for Hypertext Pre-processor, that earlier
stood for Personal Home Pages. PHP scripts can only be interpreted on a server that
has PHP installed

 What Can PHP Do?


 PHP can generate dynamic page content
 PHP can create, open, read, write, delete, and close files on the server
 PHP can collect form data
 PHP can send and receive cookies
 PHP can add, delete, modify data in your database
 PHP can be used to control user-access
 PHP can encrypt data

G.P.KHAMGAON Page 5
AGE CALCULATOR

2. HTML

 HTML stands for Hyper Text Markup Language


 HTML describes the structure of a Web page
 HTML consists of a series of elements
 HTML elements tell the browser how to display the content

 What is HTML used for?

HTML is used to create electronic documents (called pages) that are displayed on
the World Wide Web. Each page contains a series of connections to other pages
called hyperlinks. Every web page you see on the Internet is written using one version of HTML
code or another

 What Can HTML Do?

HTML code ensures the proper formatting of text and images for your Internet browser.
Without HTML, a browser would not know how to display text as elements or load images or
other elements. HTML also provides a basic structure of the page, upon which Cascading Style
Sheets are overlaid to change its appearance. One could think of HTML as the bones (structure)
of a web page, and CSS as its skin (appearance).

G.P.KHAMGAON Page 6
AGE CALCULATOR

3. CSS

 CSS stands for Cascading Style Sheets
 CSS describes how HTML elements are to be displayed on screen, paper, or in other
media.
 CSS saves a lot of work. It can control the layout of multiple web pages all at once
 External style sheets are stored in CSS files

 What is CSS used for?

CSS is the language for describing the presentation of Web pages, including colors, layout,
and fonts. It allows one to adapt the presentation to different types of devices, such as large
screens, small screens, or printers. CSS is independent of HTML and can be used with any
XML-based markup language. The separation of HTML from CSS makes it easier to maintain
sites, share style sheets across pages, and tailor pages to different environments.

 What Can CSS Do?

CSS can style almost any HTML tag that creates a visible element on the page, including all the
HTML tags used to create headings, paragraphs, links, images, lists, and tables.
Specifically, CSS allows you to style: Text size, color, style, typeface, and alignment. Link color
and style.

G.P.KHAMGAON Page 7
AGE CALCULATOR

4. CODE

<?php

$res = false;

if (isset($_POST["submit"])) {

$dob_val = $_POST["dob"];

$dob = new DateTime($dob_val);

$today = new DateTime('today');

$obj = date_diff($dob, $today, FALSE);

$msgres = "<p> Date Of Birth is $dob_val And Age is : $obj->y </p>";

$msgres.= "<p>Year : ".$obj->y." Months : ".$obj->m." Days : ".$obj->d."</p>";

$res = true;

?>

<! DOCTYPE html>

<html Lang="en">

<head>

<style type="text/css">

td.test1 {padding: 1.1cm}

< meta charset ="utf-8">

< meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<title> Age Calculate From DOB in PHP Using Forms</title>

G.P.KHAMGAON Page 8
AGE CALCULATOR

</style>

</head>

<body background="blur.jpg">

<header><marquee><fontcolor="white"size="450"><u>AGECALCULATOR</u>

</font></marquee></header>

<br>

<br>

<br>

<table border="8" bgcolor="cyan"align="center">

<div id="php">

<td class="test1"><h2>Age Calculate From DOB in PHP Using Forms</h2>

<hr width="100%">

<form method="post">

<p> <b>Select The Date Of Birth : <input type="date" name="dob" required /></p>

<hr width="100%">

<p><center><b> <input type="submit" name="submit" value="Result" ></center></b> </p>

<hr width="100%">

<?php

if ($res) {

echo "<div class='resultdiv'><center><b> $msgres </center></div>";

G.P.KHAMGAON Page 9
AGE CALCULATOR

?>

</td>

</form>

</div>

</body>

</html>

G.P.KHAMGAON Page 10
AGE CALCULATOR

5. OUTPUT

G.P.KHAMGAON Page 11
AGE CALCULATOR

6. ADVANTAGES

 One could get the age of any person.


 Also get the future age of the person.
 Get the age in year, month and day.
 Get the age accurately.

G.P.KHAMGAON Page 12
AGE CALCULATOR

7. CONCLUSION

In this project, we had build Age Calculator using PHP, JAVASCRIPT and HTML. We
had successfully implemented the date () to get current date in PHP. The PHP date () function
formats a timestamp to a more readable date and time. There are some characters that are
commonly used for dates that is d, m, y.We have also used xamp server to run the project, Xamp
server is the open source server.

G.P.KHAMGAON Page 13
AGE CALCULATOR

8. REFERENCE

 https://buddypunch.com/uncategorized/business-advantages-using-time-clocks/
 https://www.w3schools.com/php/php_date.asp
 https://www.w3schools.in/php/date-time/
 https://en.wikipedia.org/wiki/Yahoo!_Widgets
 https://en.wikipedia.org/wiki/PHP
 https://www.geeksforgeeks.org/php-date_default_timezone_set-function/

G.P.KHAMGAON Page 14

You might also like