Php 需要合并mysql表中的两列Date和Time,并找出与当前日期和时间的差异

Php 需要合并mysql表中的两列Date和Time,并找出与当前日期和时间的差异,php,mysql,sql,date,time,Php,Mysql,Sql,Date,Time,事实上,我需要列出的数据是不超过24小时的邮件日期和时间 我在数据库中的两个不同列中存储了邮件日期和邮件时间 请给出我写的以下查询中的有效输入 $CTime = strtotime(date('Y-m-d H:i:s')); //getting the 24 hours back time $Btime = $CTime - 86400; $listingInvoice = mysqli_query($conn, "SELECT *, (CONC

事实上,我需要列出的数据是不超过24小时的邮件日期和时间

我在数据库中的两个不同列中存储了邮件日期和邮件时间

请给出我写的以下查询中的有效输入

      $CTime = strtotime(date('Y-m-d H:i:s'));
      //getting the 24 hours back time
      $Btime = $CTime - 86400;

      $listingInvoice = mysqli_query($conn, "SELECT *, (CONCAT(MailDate, MailTime)) AS MailDT FROM approved WHERE JobStatus='MailedToClient' && MailDT > '$Btime'");

请检查数据库不同列中的日期和时间,并找到值,即距离当前时间不超过24小时

      date_default_timezone_set('Asia/Kolkata');

      //getting the current date and time...
      $CTime = date('Y-m-d H:i:s');

      //convert to string the current date and time...
      $CSTime = strtotime(date('Y-m-d H:i:s'));

      //Minus the 86400(value of 24 Hrs in seconds) in the converted date and time string
      $BStime = $CSTime - 86400;

      //getting the value of date and time before 24 Hrs...
      $BTime = date('Y-m-d H:i:s', $BStime);

      //Now the query is...
      $reject = mysqli_query($conn, "SELECT * FROM approved WHERE JobStatus='MailToClient' && MailDateTime BETWEEN '$BTime' AND '$CTime'");
      $row = mysqli_num_rows($reject);
      if ($row == '0')
      {
        echo "No Jobs Mails SENT for the Last 24 Hrs";
      }
      else
      {
        ....
      }