WP Date and Time Shortcode


Shortcode to show any current, past, and future date or time. Display this, previous, or next year, month, day, etc. in your posts and pages.

This is probably the last date and time shortcode plugin you will ever need for your websites since it is very rich in features.

It takes lots of efforts to develop and support a plugin. Please send us your feedback and questions to fix your issue before leaving a bad review.

Are you satisfied by using this plugin? Consider leaving a 5 star review.

If you need support or more information about this free plugin please see the description and the F.A.Q. section below or write in the Support Forum.

Shortcode/s usage examples

Real-time working examples of the shortcodes can be found at the page of WP Date and Time Shortcode on Denra.com.


  • Show date and/or time in the default WordPress format.
  • Show date and/or time in custom format based on PHP date() characters.
  • Show year separately as 4 or 2-digit number (e.g. 1999 or 99).
  • Show month as number (1-12), full name (January-December) or 3-letter name (Jan-Dec).
  • Show day as number with or without leading zero, with or without suffix (st, nd, rd, th).
  • Show hour, minutes, seconds with or without leading zero.
  • Show day of week as number (1-7), full name (Monday-Sunday) or three letters (Mon-Sun).
  • Show the day of the year (1-366).
  • Show the week of the year (1-52).
  • Show the number of days for the month (28-31).
  • Show the number of days in February for the year (28 or 29).
  • Show timezone and timezone abbreviation.
  • Show the first day from a list of next coming weekdays, days of month, or the last day of the current month.
  • Add or subtract years, months, days, hours, minutes and/or seconds before showing the final result.
  • Set post/page creation or modification time (including GMT variants) as “init” attribute.

Attributes and values

The shortcode tag can be used as both [wp-dt] and [wp_dt] at your choice. The attributes for the shortcode are:

  • item – what date and time information to show. The used values are:
    • date-time – default WP date and time format (default value)
    • custom – custom format using the PHP date() characters
    • date – default WP date format
    • time – default WP time format
    • year, years – 4-digit year
    • year-short, years-short – 2-digit year
    • month, months – month as number (1-12)
    • month-name – month as name (January-December)
    • month-name-short – month as 3-letter name (Jan-Dec)
    • day, days – day of month
    • hour, hours – hours
    • minute, minutes – minutes
    • second, seconds – seconds
    • day-of-year – day of the year as number
    • days-in-month – number of days in the month
    • days-in-february – number of days in the month of February for the year
    • weekday – day of the week as number (1-7)
    • weekday-name – day of the week as full name (Monday-Sunday)
    • weekday-name-short – day of the week as short 3-letter name (Mon-Sun)
    • week-of-year – week of year, since first Monday of the year (1-52)
    • am-pm – shows am/pm or AM/PM according to the am_pm attribute (“L” or “U”)
    • timezone – show the timezone
    • timezone-abbreviation – show the timezone abbreviation
  • format – date format used with the PHP date() function only when item is set to custom
  • init – set the basic date and time for the shortcode; defaults to the WordPress time in the current timezone.
    • initial date and time string preferably in MySQL format – Y-m-d H:i:s e.g. “2019-09-16 17:45:53”)
    • now – the default initial current date and time based on the WordPress General settings timezone
    • post-created – gets the post/page creation date and time
    • post-created-gmt – gets the post/page creation date and time GMT
    • post-modified – gets the post/page last modification date and time
    • post-modified-gmt – gets the post/page last modification date and time GMT
  • next – move the init date and time to the next coming selected (can have more than one value separated by comma)
    • mon, tue, wed, thu, fri, sat, sun – weekday shortname (and with first letter in uppercase)
    • 131 – day of month
    • last-day-of-month – the last day of month – 28, 29, 30 or 31
  • i18n – set months and weeks names to be displayed in the current language (‘yes’ by default)
  • days_suffix – set suffix st, nd, rd, th for the day and days item e.g. 1st, 2nd, 3rd, 4th, etc.
  • hours_24 – set 24 or 12 hours format
  • am_pm – used with the am-pm item when 12 hours format is preferred: “L” for lowercase (am, pm) or “U” for uppercase (AM, PM)
  • years – change in years e.g. years="+1" or years="-1"
  • months – change in months e.g. months="+2" or months="-2"
  • days – change in days e.g. days="+7" or days="-7"
  • hours – change in hours e.g. hours="+12" or hours="-12"
  • minutes, minutes_change – change in minutes e.g. minutes="+30" or minutes="-30"
  • seconds, seconds_change – change in seconds e.g. seconds="+45" or seconds="-45"
  • zero – show loading zero when months, days, hours, minutes and seconds are displayed. Old ones ‘x-zero’ for each separate item are still supported for compatibility.

IMPORTANT: Please always use straight quotes when adding the attributes. The curly/smart ones are not recognized by the WordPress shortcode functions.

You can also use directly the following shortcodes with wp-dt-item and miss the item attribute:

  • [wp-dt-date-time]
  • [wp-dt-date]
  • [wp-dt-time]
  • [wp-dt-custom]
  • [wp-dt-year], [wp-dt-years]
  • [wp-dt-year-short]
  • [wp-dt-month], [wp-dt-months]
  • [wp-dt-month-name]
  • [wp-dt-month-name-short]
  • [wp-dt-day], [wp-dt-days]
  • [wp-dt-hour], [wp-dt-hours]
  • [wp-dt-minute], [wp-dt-minutes]
  • [wp-dt-second], [wp-dt-seconds]
  • [wp-dt-day-of-year]
  • [wp-dt-days-in-month]
  • [wp-dt-days-in-february]
  • [wp-dt-days-in-year]
  • [wp-dt-weekday]
  • [wp-dt-weekday-name]
  • [wp-dt-weekday-name-short]
  • [wp-dt-week-of-year]
  • [wp-dt-am-pm]
  • [wp-dt-timezone]
  • [wp-dt-timezone-abbreviation]

(COMING SOON) PRO EDITION with an annual maintenance subscription plan

WP Date and Time Shortcode is fully FREE and contains all main features that are needed by most users. Check them out!

However, since we want to continue supporting this free plugin and adding new non-basic features, we have decided to offer a Pro edition with an annual maintenance subscription plan offered at a very (very) affordable price per website.

Note: All users who have already donated 9 or more EUR to this plugin until March 31, 2020 will get the first year of subscription for 1 website for free. They will be contacted when it is available.

What will you get with WP Date and Time Shortcode Pro in the near future?

  • Technical support by email and Facebook Messenger chat on our website. The free version will be supported by the Support Forum only.
  • JavaScript AJAX display of the shortcode result even on cached pages. You won’t need to turn off the caching for any page and post!
  • Additional init values:
    • first-visit – first visit date and time (saved as cookie, session and user option is possible).
    • passover-catholic
    • passover-orthodox
    • easter-catholic
    • easter-orthodox
    • mothers-day
    • fathers-day
    • columbus-day
    • thanksgiving-day
    • black-friday
    • cyber-monday
    • hanukkah
    • christmas
    • new-year
    • new-year-china
  • Additional attributes:
    • style – change font face, color and size;
    • timezone – modify the shortcode result to the visitor’s timezone (not 100% accurate since it gets the timezone by IP address);
    • ticking – dynamically change as ticking text clock;
  • Shortcode Wizard – create shortcodes using an easy to use step-by-step wizard.
  • Menu Location – change the menu display – main admin menu, settings menu, top menu, or turn off all.
  • And more.

IMPORTANT NOTE: Not all Pro features will be released in the first Pro version since more work and testing is needed for some of them.


From WordPress Dashboard

  1. Navigate to Plugins -> Add New from your WordPress dashboard.
  2. Search for WP Date and Time Shortcode and install it.
  3. Activate the plugin.

Manual Installation

  1. Download the plugin file: wp-date-and-time-shortcode.zip.
  2. Unzip the file.
  3. Upload the wp-date-and-time-shortcode folder to your /wp-content/plugins directory (do not rename the folder).
  4. Activate the plugin from the Plugins menu.

It will start doing it’s job as soon as you put the shortcode in your page or post. That’s all, folks!


Can I use both `[wp-dt]` and `[wp_dt]` interchangeably?

Yes, you can. We have added both shortcode names because some people like underscores and others – hyphens, and it might lead to errors. However in the wp-dt-item shortcode format (when the item attribute is missed) only hyphens can be used.

Why the shown shortcode result is not updated for every single visit?

If you are using a caching plugin you may need to exclude the page or post with the shortcode from it so the content may be generated dynamically. If you are using the init attribute with a fixed initial value you may also block the change of the shortcode result if needed.

Why some or all of the used attributes of the shortcode do not work?

Please make sure that you are using only straight double quotes (“) and not curly/smart ones(„“) for the attributes. The curly ones are not recognized by the shortcode functions. If you are using the straight quotes only and you are still having issues please contact us for support.

I have an idea how this plugin can be improved. Can I send it somehow?

We have completed the development of Free edition of this plugin and it has a big number of features which may cover every basic need. In future we will be only supporting it for WordPress version compatibility and bugs. However we will be releasing a Pro edition soon with an annual subscription plan and it will have many new features. Please send all your suggestions and ideas to our e-mail address and they may be developed and included in the paid product in future. Please note that if you have suggested a new feature and it is implemented you will get a one year subscription for 1 website for free.


April 1, 2020
Great Plugin Easy to use and support team is very good. Very fast services and support till the end. Thanks for your support
November 21, 2019
For date calculation use " " and everything will work fine! thank you!
Read all 3 reviews

Contributors & Developers

“WP Date and Time Shortcode” is open source software. The following people have contributed to this plugin.




  • Fixed: A critical bug with shortcodes attributes was fixed. Please update!


  • Fixed: A critical bug with some default attributes’ initialization was fixed. Please update!
  • Improved: Added years-short alias for year-short.
  • Improved: There is only one zero attribute now for months, days, hours, minutes and seconds. Old ones ‘x_zero’ are still supported for compatibility.
  • Other: WordPress 5.4 compatibility.


  • Fix: Item days-in-month works even when PHP on server is complied without –enable-calendar option.
  • Other: WordPress 5.3.2 compatibility.


  • Added: Shortcode item days-in-year added.
  • Added: Shortcode duplicate/alias item date-time for item datetime.
  • Added: next attribute that helps in displaying the next date from a list of weekdays, days of month, or the last day of the current month.
  • Improved: Framework update and bug fixes.


  • Fixed: week-of-year item not showing correctly.


  • Framework update and bug fixes.


  • Added: Denra Plugins Framework 1.0.
  • Added: Feature to set the init attribute from page/post creation or modification time.


  • Added: Shorter version for the _change attributes removing the _change part.


  • Added: More shortcodes for easier and faster use by missing the item attribute.


  • Fixed: A couple of bug fixes after the initial release


  • Initial release