Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2008
    Posts
    36
    Plugin Contributions
    0

    Default Subtracting 15 minutes from Time, to display a pickup time

    I am trying to display the pickup date and time on invoices. I need the pickup time to be 15 minutes less the order_delivery_date_time. Any help is appreciated. Thanks

    if ($order->info['order_delivery_date_time'] > '00:00:01') {
    $pos = $pdf->ezText("<b>" . PDFOC_TEXT_ORDER_DATE . " </b>" . zen_date_short($order->info['order_delivery_date_day']) . " " . convert24to12($order->info['order_delivery_date_time']));
    } else {
    $pos = $pdf->ezText("<b>" . PDFOC_TEXT_ORDER_DATE . " </b>" . zen_date_short($order->info['order_delivery_date_day']) . " " . "ASAP");
    }

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    1,939
    Plugin Contributions
    20

    Default Re: Subtracting 15 minutes from Time

    Googling php subtract minutes brings up a slew of pages ...

  3. #3
    Join Date
    Nov 2008
    Posts
    36
    Plugin Contributions
    0

    Default Re: Subtracting 15 minutes from Time

    Quote Originally Posted by lat9 View Post
    Googling php subtract minutes brings up a slew of pages ...
    I tried to find a solution and have come up empty. I have no experience with MySQL Date and Time Functions. If someone could instruct me on how to subtract 15 minutes from $order->info['order_delivery_date_time'] i would appreciate it. Thanks

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    1,939
    Plugin Contributions
    20

    Default Re: Subtracting 15 minutes from Time

    Try the following. If you've got a variable that is in 24-hour time format (HH:MM:SS), then simply replace the $order_time variable in the explode (and delete the first line) to get your 15-minutes off:
    Code:
    $order_time = '08:54:00';
    $time = explode(':', $order_time);
    $newTime = mktime($time[0], $time[1], $time[2]) - 15 * 60; // $order_time - 15 minutes
    $pickupTime = strftime('%H:%M:%S', $newTime);  // $pickupTime = '08:39:00'

 

 

Similar Threads

  1. Increase log-in time past 24 minutes?
    By joejoejoe in forum Managing Customers and Orders
    Replies: 2
    Last Post: 17 Nov 2011, 02:38 AM
  2. Order Time Different From Actual Time
    By bookwise in forum Managing Customers and Orders
    Replies: 1
    Last Post: 10 Feb 2011, 01:30 PM
  3. auspost modulesIt fails to caculate the postage from time to time
    By zhshji in forum Addon Shipping Modules
    Replies: 3
    Last Post: 22 Jul 2009, 03:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •