how can i program two dates using date picker and php?
i made a program for our company which is a travel agency. i have this problem about this inputing a flight details on my program es开发者_如何转开发pecially on dates. im using date picker so that it will be easy for a user to input a particular dates.how can i set a program in viewing details between two selected dates. For example, from 13, jun.2011 until 18, jun 2011, i want to display all infos between those dates. i set my dates table in mysql as varchar..how can i program this one..can you help me ? can you give an examples of program regarding this issue?
More modern browsers (like Opera) allow you to use a datepicker with straight HTML - but that's only OK if you use an intranet and you can be confident of the browsers you need to support. The more common solution is to use javascript.
http://diveintohtml5.ep.io/forms.html
If you like jQuery (and plenty do) - this library gives you a good datepicker solution.
http://jqueryui.com/demos/datepicker/
If you want to display all the dates between two selected dates...
$thisTime = strtotime($selectedStartDate);
$endTime = strtotime($selectedEndDate);
while($thisTime < $endTime) {
echo date('Y-m-d', $thisTime);
$thisTime = strtotime('plus one day', $thisTime);
}
echo date('Y-m-d', $endTime);
精彩评论