dongpu3792 2010-12-31 11:08
浏览 62

预约系统,检查特定时间是否有人

i am working on an appointment system, the problem i am facing is in a function where i want to check if the person with whom someone wants to book an appointment is available at that time or not.

each person has fixed daily time slot for example 02:00:00 to 04:30:00 during which anyone can contact him/her, now when booking appointment, i wanna check if person is available at the time when someone is willing to book an appointment or not.

here is the code:

    $strtTime = $PA[0]['starttime'];   //02:00:00
    $endTime = $PA[0]['endtime'];    //04:30:00        

    $expectedTime = date('g:i:s', strtotime($dteTime));   // $dteTime = 2010-12-31 02:30


    if($strtTime < $expectedTime && $endTime > $expectedTime) // the second condition is returning false
    {
        echo "PAA is available";
    }
    else
    {
        echo  "PAA is not available at that time slot.";
        exit();           
    }
  • 写回答

1条回答 默认 最新

  • doyp9057 2010-12-31 11:18
    关注

    date('g:i:s' return 2:30:00

    04:30:00 > 2:30:00 is false, because of alpha sort ("04" is < "2")

    So change date('g:i:s' to date('H:i:s'

    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 如何将下列的“无限压缩存储器”设计出来
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口