Zen Cart custom software development, Zen Cart modules, Zen Cart Expert eCommerce with Zen Cart!

Zen Cart Show Customer Time

Zen Cart Show Customer Time

The Show Customer Time mod allows you to see the local time at the location specified in a customer's primary address. This can be displayed on the order details page or on the customer details page.

Donate: This is free software. Show your appreciation by supporting my efforts. Donate

Relevance: Zen Cart™ 1.3.9 and above

Current Version: 1.0 (version history)

Support Thread: Show Customer Time Support Thread

Cost: Free, but donation appreciated

Installed Cost: $100.00 Buy Professional Installation by That Software Guy

Installation Difficulty: Moderate

Installation Instructions: click here

Location: Zen Cart Plugins, under Admin Tools

Download: Show Customer Time in Zen Cart Plugins

FAQ: click here


You have to call a customer - but what time is it where they live? With Show Customer Time, you can check before you call.

Show Customer Time allows you to easily display the customer's local time on the order details page or on the customer details page.

Here's an example of how the Show Customer Time mod installed will look:

Show Customer Time

Zen Cart Show Customer Time

In this case, I styled it green by adding this to admin/includes/stylesheet.css:
#cust_time {
  color: green;

In cases where the customer's local time is a different day than it is where you are, this is shown by adding a day to the time displayed. It's Thursday 5:00 PM here in Florida, but it's way too early to call Singapore:
Zen Cart Show Customer Time


Timezone determination is incredibly complex and constantly changing, because the mapping from region to timezone is not 1-1. This is a best-effort implementation. If increased accuracy is important to you, you can use this code as a starting point, and integrate a commercial API or data source (which you will have to pay for).

For countries other than the United States, Canada and Australia, the first timezone returned for that country is used. For large countries like Russia, this will not be accurate, so if you have a lot of customers in a country with many timezones, you should extend this mod. For most other countries, it should be reasonably accurate.

For the United States, Canada and Australia, the following techniques were used:
  • For the United States, states are mapped to the timezone in which most people live, and then a zipcode lookup is done. If zipcode data is available, it is used.
  • For Canada, each province is mapped to the timezone in which the majority of residents live.
  • For Australia, each state is mapped to the timezone in which the majority of residents live.
You can add countries that are relevant to you to this list by following these examples.

Installation Instructions:

Before starting, back up everything! Try this in a test environment prior to installing it on a live shop.
  1. Go to Admin > Tools > Install SQL Patches and run the SQL file.
  2. Upload the files in the admin folder to the admin folder in your store.
  3. To display local time on the order details page, edit admin/orders.php, and after
                    <td class="main"><a href="tel:<?php echo $order->customer['telephone']; ?>"><?php echo $order->customer['telephone']; ?></a></td>
                    <td><?php echo show_customer_time($order->customer['id']); ?></td>
  4. To display local time on the customer details page, edit admin/customers.php, and after
      } else {
        echo zen_draw_input_field('customers_telephone', htmlspecialchars($cInfo->customers_telephone, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', 15), true);
       <td><?php echo show_customer_time($cInfo->customers_id); ?></td>

Major Versions

  • 1.0 06/01/2018 - First Release


Q: Google/USPS/Joe's Geolocation has an API - why don't you just use that?
A: If you read the Terms of Service of these APIs, you will generally find that they are put there for the benefit of the company providing them, not for your convenience. You are not allowed to use them for general purposes; you have to use them as part of your work with that company (showing Google maps, shipping packages via USPS, etc.)

Q: Where did you get the Zip code data?
A: There are still a few free sources of this kind of data; the issue is that they're generally not as well supported as paid sources. The one I used was the Open Source zip2timezone database.