I spent about 15 minutes writing a small PHP function for one of my sites, and then another hour writing it up. What for?

Well, let’s back up. If you are running online events where people might come from anywhere, there can always be challenges for getting the right time to people. For our NMC events, while our office is in Austin, we have staff in 3 other time zones, and people in our community from maybe another 14 or more zones on top of that.

If I say something starts at 2:00pm Central Time, then it puts it on everyone else to figure out when that is (and I’ve seen event sites where they do not even provide the reference time zone). If were all proper and versatile, we’d use Greenwich Mean Time, since everyone knows their offset, right? (I am -7 what are you?)

Most of the time , our event times are referenced to Pacific Time, since that is where our server is hosted, but even if we provide Pacific, Central, and Eastern Time, what about folks in Spain? New Zealand? Hong Kong?

This came to me a lot when our events picked up in Second Life back in 2006-2007. They used Pacific Time too as a reference time (actually for a long time they called it SLT for Second Life Time, and people still say that).

I started early using the World Time Clock fixed time. It allows you to enter a date time, and reference time zone, and generates a link that produces a big chart that converts that to other times around the world.

it’s silly to not think of the world as your audience, and most of the world is on a different time zone, like those weird half hour ones in South Australia.

For example, if there was an event, like tonight my dinner, at 6:00 PM, I’d enter the date and time in the form, and scroll all the way down to the bottom to select my time zone (U.S.A. – Arizona – Phoenix), and the form generates for me this URL

http://www.timeanddate.com/worldclock/fixedtime.html?month=10&day=23&year=2010&hour=18&min=0&sec=0&p1=197

which I can use to generate a URL that lets anyone else in the world know when I am having dinner, in their local time zone:

And in our event web pages I might say:

hey, tonight’s event is Alan’s Dinner! It is taking place October 22 at 6:00 PM PST (check for local time)

I was pretty adamant about getting our folks to add this “check for local time” link. If you inspect the URL, you can actually make new ones just by adjusting the values in the URL string (The site does provide a URL shortener if you dont want to display a monster long URL).

But here is the thing that struck me today- for our MIDEA site, I am using the WP custom post types for our events, so I already have built into the date, a value for the start date/time (it is the unix time version of the date/time, number of seconds since 1970). Since I already have the data, I thought it would be easy to write a function that auto generates the World Time Clock Link.

It was easy.

and you can see it in action in the top gray bars on pages like http://midea.nmc.org/event/horizonreportmuseumwebinar/.

It’s really bone simple PHP, just like to write it up. I set up a code demo page so you can see it in action:

Actually, it was just fun to dip my paws into the code. Even if it is bone head simple code.

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Comments

  1. Man,

    You are on a roll, and that check local time link is mint. What else is mint, is the way you set up your table in this post to show what your dinner time means around the world.

    Very trippy, and very cool.

Leave a Reply

Your email address will not be published. Required fields are marked *