Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 844905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:21:39+00:00 2026-05-15T06:21:39+00:00

Basically what I want to do is to send an email to follow up

  • 0

Basically what I want to do is to send an email to follow up on order placed in 3 hours later.

What I try to do is to get the current date (up to hours level), then compare with the orderdate+ 3 hours, to see whether it match.

Example orderdate: 2010-06-12 18, after add 3 hours should become 2010-06-12 21

However, after add hour, the final result sometimes become bigger, sometimes become smaller… something wrong.

$now= date('Y-m-d H');
echo $now . "<br>";


...
...

while ($data = mysql_fetch_array ($result))
{
 $orderid = $data['orderid'];
 $orddate = $data['orddate'];
 $corddate= date('Y-m-d H:i:s', $orddate);


 $year = substr ($corddate, 0, 4);
 $month = substr ($corddate, 5, 2);
 $day = substr ($corddate, 8, 2);
 $hour = substr ($corddate, 11, 2);
 $actualorderdate= $year . "-" . $month . "-" . $day . " " . $hour;


 $new_time = mktime ($hour+3, 0, 0, $month, $day, $year);
 $year = date ('Y', $new_time);
 $month = date ('m', $new_time);
 $day=  date ('d', $new_time);
 $hour=  date ('h', $new_time);
 $xhourslater= $year . "-" . $month . "-" . $day . " " . $hour;


 echo "actualorderdate: ". $actualorderdate. " xhourslater: " . $xhourslater. "<br>";

 if($now==$xhourslater)
 {
  echo "now is 3 hours later" . "<br>";
  //send email follow up, then update status as sent, in order not to resend anytime in the 3rd hour.

 }


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:21:40+00:00Added an answer on May 15, 2026 at 6:21 am

    Seems to me like you’re doing a lot of excess parsing for nothing.

    $orddate = $data['orddate'];
    $actualOrderDate = date('Y-m-d H:i:s', $orddate);
    $timeToSendEmail = date('Y-m-d H:i:s', strtotime('+3 hours', $orddate)); //Assuming $orddate is a timestamp int. If not, you'll have to do some calculations or something there, possibly using date() again.
    

    Basically, you just want to have the order time + 3 hours, so use php’s strtotime (http://php.net/manual/en/function.strtotime.php) function. Very helpful.

    If that’s not what you want, please post some test data so it’s easier to figure out what might be going funky.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new with cron job in php,basically i want to send email to
I have this form. Basically what I want is to send a auto-response with
I have a third party program which basically allows users to send email and
Basically I want to send gps coordinates (displayed on a map in the iPhone)
I'm trying to send an email with an HTML attachment, I don't want the
I have a view called send_confirmation email - which basically sends emails. I want
I basically want something like: TextView Button Button . . . TextView TextView SeekBar
I basically want to setup a relationship similar to Netflix's DVD rental model. There
I basically want to do: git checkout branchA git checkout -b branchB <commit_id> which
I basically want the same functionality as facebook, twitter and all those other infinite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.