by Hiroshi on August 7th, 2008
We can find out the difference between two given dates in PHP very easily. Consider the following PHP script:
<?php function dateDiff($dformat, $endDate, $beginDate) { $date_parts1=explode($dformat, $beginDate); $date_parts2=explode($dformat, $endDate); $start_date=gregoriantojd($date_parts1[1], $date_parts1[0], $date_parts1[2]); $end_date=gregoriantojd($date_parts2[1], $date_parts2[0], $date_parts2[2]); return $end_date - $start_date; } // adjust date parts according to date format 102 for d-m-y and 012 for m-d-y $date1="30-06-2008"; $date2="06-08-2008"; print "If we minus " . $date1 . " from " . $date2 . " we get " . dateDiff("-", $date2, $date1) . "."; ?>
Result will be
If we minus 30-06-2008 from 06-08-2008 we get 37
date, date difference in php, time, useful
4 Reviews
Leave a Review
Incoming Searches
date difference in php, datediff in php, date difference php, php date difference, datediff php, php date diff, date diff php, date_diff php, date diff in php, datedifference in php, date differnce php, php difference date 2038, php check booked date, php code datedifference, php code for date difference, two date difference php, query for date dif in php, php datediff, php datediff example, php script for date difference, php datediff in days, php get date difference, PHP date_diff, php function date difference, how we can find out the date difference in php, how to get php date differance, date difference for php, date difference function in php, date difference in days with php, date difference validation in php, DATEDIF php, datediff() in php, date_diff example php, datte dif php, example of datediff in php, find date diff in php, get datediff in php, get the date difference in php, how to find out date difference php, how to find the date difference in php, date diff mysql php



where can i put this coding at the html form..
i understand this coding but how can can implement this at html form
@Lyyza: Actually, not for html form. You need to put it in some PHP file to work. Just put the code and modify date1 and date2 variables.
can u give example where should i put that code in the php file.?
@Lyyza
LOL