w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Need To combine two columns Date and Time in mysql table and find the difference with current date and time

Please check the date and time taken from different columns of database and find the value i.e., not exceed 24 hrs from the current time.

      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
      {
        ....
      }




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.