PHP - Calculate experience in months, years and days from two given dates

PHP - Calculate experience in months, years and days from two given dates

In this tutorial, I will tell you how to calculate total experience of your job in months, years and days from two given dates using PHP script.

Using this script, you can calculate your age from birth date to present day.

  1. <?php
  2. if(isset($_POST['submit'])){
  3.     $datetime1 = new DateTime($_POST['start_date']);
  4.     $datetime2 = new DateTime($_POST['end_date']);
  5.     $interval = $datetime1->diff($datetime2);
  6.     echo $interval->format('%y years %m months and %d days');
  7. }
  8. ?>
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12.     <title>Online Experience Calculator</title>
  13. </head>
  14. <body>
  15. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  16. Start Date : <input type="date" name="start_date" required="required"><br>
  17. End Date : <input type="date" name="end_date" required="required"><br>
  18. <input type="submit" name="submit" value="Calculate">
  19. </form>
  20. </body>
  21. </html>

The $_SERVER["PHP_SELF"] is a super global variable that returns the name and path of the current file.

Phone: (+91) 8800417876
Noida, 201301
kadıköy escort tuzla escort kurtköy escort kartal escort maltepe escort bakırköy escort ataşehir escort
En kaliteli ve Gerçek sex hikaye 'lerini okuyabilir ve kendi seks hikayelerinizi paylaşabilirsiniz.
Türkiyenin en iyi hd porno izle sitesi 7dak ile doyumsuz türk sikişleri seyredin.
şişli escort
pendik escort
izmir escort izmir escort izmir escort izmir escort denizli escort antalya escort antalya escort antalya escort izmir escort izmir escort izmir escort izmir escort izmir escort
ankara escort
çeşme escort
kurtköy escort escort pendik
Betwinner