UP TO 35% OFF!


  • Home
  • The Auto-Local Time Display DKI shortcode

Auto-Local Time Display Shortcode

In this article: About Time Zone DKI | Time Zone DKI Usages

About the Auto-Local Time Display Shortcode

The If-So Auto-Local Time Display shortcode helps you reach visitors across the globe by showing an event time calculated according to their visitor’s time zone. 

Make sure no one misses out on your events, sales, and promotions again due to unfortunate and preventable calculation mistakes.

Real-life example

🕐 Our next webinar

25.10 | 17:00 UTC

according to your time zone (Unknown)

Shortcodes used in the above example:

[ifsoDKI type="time" show="user-geo-timezone-sensitive" time="10/25 17:00" format="G:i"] according to your time zone ([ifsoDKI type="geo" show="timezone"])

Use Cases 

  • Display when your webinar will start in a visitor’s time zone
  • Show your operating hours according to the time zone your visitors are located

A simple shortcode does the math for you

Displaying the time calculated according to the user’s time zone is done by implementing a simple shortcode. In addition to the time and the date, the shortcode allows you complete control of the display format (i.e. January 5, 5/1/2022, .06.31.22, etc.)

How to use the shortcode on your website

  1. Copy the shortcode below and paste it on your site
[ifsoDKI type='time' show='user-geo-timezone-sensitive' time='04/25/2022 08:00' format='n/j/o, G:i']
  1. Set the time and date of your event (the date is in American format mm/dd/yyyy).The time you set in the shortcode corresponds to your website’s timezone settings (Settings > General on your WordPress Dashboard).
  2. Set the outputted date format (see the “Time Formatting” section below)

Time Formatting

Defining the outputted date format can easily be done using the shortcode’s “Format” parameter. Setting the format is done using letters that represent a date value.

For example, the letter “D” will output a textual representation of a day in three letters, the letter “j” will output the day of the month without leading zeros (1 to 31), etc

The table below specifies some of the most popular date formats. A full list of the date formats can be found here.

dDay of the month, 2 digits with leading zeros01 to 31
DA textual representation of a day, three lettersMon through Sun
jDay of the month without leading zeros1 to 31
l (lowercase ‘L’)A full textual representation of the day of the weekSunday through Saturday
NISO-8601 numeric representation of the day of the week1 (for Monday) through 7 (for Sunday)
SEnglish ordinal suffix for the day of the month, 2 charactersst, nd, rd or th. Works well with j
wNumeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)
zThe day of the year (starting from 0)0 through 365
WISO-8601 week number of year, weeks starting on MondayExample: 42 (the 42nd week in the year)
FA full textual representation of a month, such as January or MarchJanuary through December
mNumeric representation of a month, with leading zeros01 through 12
MA short textual representation of a month, three lettersJan through Dec
nNumeric representation of a month, without leading zeros1 through 12
tNumber of days in the given month28 through 31
LWhether it’s a leap year1 if it is a leap year, 0 otherwise.
oISO-8601 week-numbering year. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead.Examples: 1999 or 2003
YA full numeric representation of a year, 4 digitsExamples: 1999 or 2003
yA two digit representation of a yearExamples: 99 or 03
aLowercase Ante meridiem and Post meridiemam or pm
AUppercase Ante meridiem and Post meridiemAM or PM
BSwatch Internet time000 through 999
g12-hour format of an hour without leading zeros1 through 12
G24-hour format of an hour without leading zeros0 through 23
h12-hour format of an hour with leading zeros01 through 12
H24-hour format of an hour with leading zeros00 through 23
iMinutes with leading zeros00 to 59
sSeconds with leading zeros00 through 59
uMicroseconds. Note that date() will always generate 000000 since it takes an int parameter, whereas DateTime::format() does support microseconds if DateTime was created with microseconds.Example: 654321
vMilliseconds (added in PHP 7.0.0). Same note applies as for u.Example: 654
Time zone
eTime zone identifierExamples: UTC, GMT, Atlantic/Azores
I (capital i)Whether or not the date is in daylight saving time1 if Daylight Saving Time, 0 otherwise.
ODifference to Greenwich time (GMT) without colon between hours and minutesExample: +0200
PDifference to Greenwich time (GMT) with colon between hours and minutesExample: +02:00
pThe same as P, but returns Z instead of +00:00Example: +02:00
TTime zone abbreviationExamples: EST, MDT …
ZTime zone offset in seconds. The offset for time zones west of UTC is always negative, and for those east of UTC is always positive.-43200 through 50400
Full Date/Time
cISO 8601 date2004-02-12T15:19:21+00:00
r» RFC 2822 formatted dateExample: Thu, 21 Dec 2000 16:01:07 +0200
USeconds since the Unix Epoch (January 1 1970 00:00:00 GMT)See also time()



[ifsoDKI type='time' show='user-geo-timezone-sensitive' time='04/25/2022 08:00' format='n/j/o, G:i']


Best Practice

The Auto-Local Time Display is based on an IP-to-location service that detects the user’s location and time zone. By nature, no IP-to-location service is 100% accurate. Though we do everything we can in order to be as accurate as possible, including basing our service on IPinfo,  a top-level provider which updates the database regularly, there might be cases in which the user’s location will not be detected correctly.

Live Example:

World Meditation Event
January 20, 18:30 UTC
  – based on your current time zone ()​

For your convenience, here is the code we used to create this message. The first shortcode displays the time and the date and the second one displays the user’s time zone in the yellow text box.

[ifsoDKI type='time' show='user-geo-timezone-sensitive' time='04/25/2022 08:00' format='n/j/o, G:i'] according to your timezone ([ifsoDKI type='time' show='user-geo-timezone-sensitive' time='04/25/2022 08:00' format='T'])

Setting up a recurring event

If you want to set up a recurring event, such as an event that occurs every Monday at a specific time, you can configure the ‘time’ parameter as follows:

[ifsoDKI type='time' show='user-geo-timezone-sensitive' time='Monday 07:30' format='n/j/o, G:i']

You might also be interested in:

Ready to get started?
Try it on your website