问题
datepicker :
<b>Date of Journey</b>
<input id="datepick" size="19" name="datepick" class="text_box2" title="Departure Date" />
<script type="text/javascript">
$(function() {
$( "#datepick" ).datepicker({ minDate: 0});
});
</script>
database
I want to search a bus name according to it's corresponding availability day in database.. Just cant do the write syntax for it... any help ? Thankss in advance.
回答1:
You need to convert date to day of the week, and then manipulate out put accordingly.
First parse the date picket with strtotime.
$date = strtotime($yourDateFieldValue);
Then format $date with date function.
$day = date("D", $date);
回答2:
Take out the day of the week from your date by
$day_of_week = date("D", strtotime($datepicker_date));
Here $datepicker_date is the date you getting from your datepicker. You will get three letters representation of day of the week in $date. You can manipulate it now according to your need.
For more details please refer http://php.net/manual/en/function.date.php
来源:https://stackoverflow.com/questions/20468908/match-the-date-from-datepicker-with-available-database-day-and-show-the-result