match the date from datepicker with available database day, and show the result [closed]

筅森魡賤 提交于 2020-01-01 22:23:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!