Referensi para programer

Advertisements

Breaking

Wednesday 3 May 2017

Source Code Calculating Old Retirement with PHP



Loyal night my blog buddy, tonight I will try a little to discuss about calculating the old retirement, for my friends who are working on the project about Personnel or the other must be tangent to the retirement data of someone, well this time I will give the source code for my friends To be used and hopefully useful. Okay we just make the coding, 1. First create an index.html file to accommodate the date of entry to the company
<html>
<head>
<title>Menghitung lama pensiun</title>
</head>
<body style="text-align: center;">
<h1>Masukan Tanggal lahir anda disini</h1>
<form method="post" action="proses.php">
<input type="text" name="tanggal" placeholder="Format YYYY-MM-DD"></br></br>
<button type="submit">Submit</button>
</form>
</body>
</html>


# I need to underline is the date of the date entered is the year-month-date according to international standards, for custom dates we discussed at a later time.



2. After that we make proses.php to process the final result of pension long calculation

<?php
$joining_date = $_POST['tanggal'];
$timeToAdd = "+ 56 years";
$objDateTime = DateTime::createFromFormat("Y-m-d",$joining_date);
$objDateTime->modify($timeToAdd);
$retire_date = date('d-m-Y', strtotime($joining_date));
$sekarang = date('Y');
$sisa = $objDateTime->format("Y") - $sekarang;

echo "Tanggal Anda Masuk = $retire_date</br>";
print_r('Masa Aktif anda bekerja sampai = ');print_r($objDateTime->format("d-m-Y"));
echo "</br>";
echo "Sisa Masa Aktif anda = $sisa Tahun lagi</br>";

?>



# I need to underline that is $ timeToAdd = "+ 56 years"; So the results of the calculation we work for 56 years.


Can my friends see the end result, easy is not it ??? Okay good luck, good luck .. Happy Coding, Happy Fun 😂

No comments:

Post a Comment