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. You can also donate.
If you need support or more information about this free plugin please read the description and the F.A.Q. section below or write in the Support Forum.
How it works?
Just put one of these shortcodes in your post or page content and they will work out of the box.
[wpdts]– the main shortcode which works with all attributes; equals to
[wpdts-date-time]– default date and time format from WordPress general settings
[wpdts-date]– default date format from WordPress general settings
[wpdts-time]– default time format from WordPress general settings
[wpdts-custom]– custom format using the PHP date and time formatting characters
[wpdts-year]– 4-digit year e.g. 1999 or 2134
[wpdts-year-short]– 2-digit year e.g. 99 or 34
[wpdts-month]– month as number (1-12)
[wpdts-month-name]– month as name (January-December)
[wpdts-month-name-short]– month as 3-letter name (Jan-Dec)
[wpdts-day]– day of month (1-31)
[wpdts-hour]– hours (0-24)
[wpdts-minute]– minutes (0-60)
[wpdts-second]– seconds (0-60)
[wpdts-timestamp]– Unix timestamp
[wpdts-day-of-year]– day of the year as number (1-366)
[wpdts-days-in-month]– number of days in the month (28-31)
[wpdts-days-in-february]– number of days in the month of February for the year (28-29)
[wpdts-days-in-year]– number of days in the year (365 or 366)
[wpdts-day-of-week]– day of the week as number (1-7)
[wpdts-day-of-week-name]– day of the week as full name (Monday-Sunday)
[wpdts-day-of-week-name-short]– day of the week as short 3-letter name (Mon-Sun)
[wpdts-week-of-year]– week of year, since first Monday of the year (1-52)
[wpdts-am-pm]– am/pm or AM/PM according to the am_pm attribute (« L » or « U »)
[wpdts-time-zone]– the current time-zone for the shortcode result
If you need to use the shortcodes in other places (like titles, navigation menus, footers, widgets, etc.) additional code or plugins may be needed to turn them on in your theme if they are not supported by default. See F.A.Q. section for details.
If you need to view real-time examples of usage or set up custom attributes to show specific date or time please see the page of WP Date and Time Shortcode on Denra.com.
If you need more detailed features please use the shortcode attributes.
- Show date and/or time in the default WordPress formats.
- Show date and/or time in custom format based on the PHP date and time formatting characters
- Show date and/or time based on fixed SQL/date/time format or any relative date and time format
- 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 number of days for the month (28-31).
- Show the number of days in February for the year (28 or 29).
- Show the day of the year (365 or 366).
- Show the week of the year (1-52).
- Show currently used time-zone.
- 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
You can add the following attributes to
[wpdts] to show the date and time that you need:
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 and time formatting characters
date– default WP date format
time– default WP time format
years– 4-digit year
years-short– 2-digit year
months– month as number (1-12)
month-name– month as name (January-December)
month-name-short– month as 3-letter name (Jan-Dec)
days– day of month (1-31)
hours– hours (0-24)
minutes– minutes (0-60)
seconds– seconds (0-60)
timestamp– Unix timestamp
day-of-year– day of the year as number (1-366)
days-in-month– number of days in the month (28-31)
days-in-february– number of days in the month of February for the year (28-29)
day-of-week– day of the week as number (1-7)
day-of-week-name– day of the week as full name (Monday-Sunday)
day-of-week-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– am/pm or AM/PM according to the am_pm attribute (« L » or « U »)
time-zone– the current time-zone for the shortcode result
format– date format used with the PHP date and time formatting characters only when
itemis set to
start– set the basic date and time for the shortcode; defaults to the WordPress time in the current timezone.
- initial date and/or time string based on fixed SQL/date/time formats (e.g. 2019-09-16 17:45:53 or Sep 16, 2019 17:45:53) or any relative date and time format
now– the default initial current date and time based on the WordPress General settings time-zone
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 start date and time to the next coming selected (can have more than one value separated by comma)
sun– weekday shortname (and with first letter in uppercase)
31– day of month
last-day-of-month– the last day of month – 28, 29, 30, or 31
time_zone– select the time-zone for which to display the result from the available PHP time-zones.
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
daysitem e.g. 1st, 2nd, 3rd, 4th, etc.
hours_24– set 12 or 24 hours format for the
am_pm– used with the
am-pmitem when 12 hours format is preferred: « L » for lowercase (am, pm) or « U » for uppercase (AM, PM)
post_id– post ID from which to get post-created(-gmt) or post-modified(-gmt)
years– change in years e.g.
months– change in months e.g.
days– change in days e.g.
hours– change in hours e.g.
minutes_change– change in minutes e.g.
seconds_change– change in seconds e.g.
zero– show leading zero when months, days, hours, minutes and seconds are displayed. Old ones ‘x-zero’ for each separate item are still supported for compatibility.
(COMING ASAP) 3.0 PRO EDITION with an annual 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 plugin and adding new non-basic features, we have decided to offer a Pro edition with an annual subscription plan offered at a very affordable price per website. We are working hard to release the Pro edition although it took us a little bit more time to prepare it than expected in the beginnig.
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.
- Additional pre-defined date and time initialization values like:
- First visit on the website (saved as cookie, session and user option if possible)
- Last visit on the website (saved as cookie, session and user option if possible)
- Catholic and Orthodox Easter dates
- Mother’s day
- Father’s day
- Columbus day
- Thanksgiving day
- Black Friday
- Cyber Monday
- New year
- Chinese new year
- and more.
- Additional items and attributes:
style– change font face, color and size;
time-zonebrowser/IP parameter – modify the shortcode result to the visitor’s timezone (not 100% accurate since it gets the timezone by IP address);
counter– dynamically change displayed values as a 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
- Navigate to
Add Newfrom your WordPress dashboard.
- Search for
WP Date and Time Shortcodeand install it.
- Activate the plugin.
- Download the plugin file:
- Unzip the file.
- Upload the
wp-date-and-time-shortcodefolder to your
/wp-content/pluginsdirectory (do not rename the folder).
- 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!
Have you already released a paid Pro edition of this plugin with more features?
We are working on such a subscription based Pro edition but it is not ready yet. It will be released ASAP but an exact date cannot be given now.
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
startattribute 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.
WordPress applies the shortcodes in post’s and page’s content by default. If your theme does not apply shortcodes in other places automatically you may need to add additional code to your child theme’s functions.php to hook into those functions where you need to see the shortcodes applied.
// For the titles.
add_filter(‘wp_title’, ‘do_shortcode’, 10);
add_filter(‘the_title’, ‘do_shortcode’, 10);
// For the menu.
add_filter(‘walker_nav_menu_start_el’, ‘do_shortcode’, 10);
If you do not know how to put the correct code you may want to use additional plugin for the purpose like this one to enable any shortcodes in other places of your website pages.
Why the major shortcode is `[wpdts]` now instead of the old `[wp-dt]` or `[wp_dt]`?
As we were improving the plugin we found out the
[wpdts]shortcode will be much more recognizable and easier to use by everyone so we decided to change the old ones. We strongly recommend the use of the new
[wpdts]shortcode although backward compatibility for
I have an idea how this plugin can be improved. Can I send it somehow?
We have generally 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 mainly 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 1-year subscription for 1 website for free.
Contributors & Developers
“WP Date and Time Shortcode” is open source software. The following people have contributed to this plugin.Contributors
Translate “WP Date and Time Shortcode” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
- Added: The missing post ID or post object for the
post_idattribute when the
post-modified(-gmt)does not throw a PHP error but shows an understandable message.
- Fixed: A bug with UTC+ or UTC- time zones. Please update if you have that type of time zone set for your website.
- Fixed: Removed a couple of warnings.
- Fixed: A bug with WordPress default time-zone for relative dates was fixed. The default time-zone works correctly now when a relative date is set in the
startparameter e.g. today, tomorrow, yesterday, next week, etc.
- Added: A specific time-zone can be used in the
startattribute e.g. America/New_York, Europe/London, Asia/Tokyo, etc.
- Added: New attribute
time_zonewas added to define for which time-zone the result must be displayed e.g. America/New_York, Europe/London, Asia/Tokyo, etc.
- Added: New
timestampparameter for the
itemattribute to show the UNIX timestamp.
- Added: New
time-zoneparameter for the
itemattribute to show the current time-zone for the shortcode result.
- Added: A post ID can be selected with a new
date-modified(-gmt)is set for
- Modified: Readme.txt info changes.
- Other: WordPress 6.2 compatibility.
- Other: WordPress 5.5.3 – 6.1 compatibility.
- Modified: Readme.txt info changes.
- Other: WordPress 5.5 compatibility.
- Added: Description how to show date and/or time based on any relative date and time format.
- Fixed: Removed Framework warnings on plugin activation and usage.
- Fixed: There was a bug in the
nextattribute in some cases when the next day is in the next month. Please update!
- Modified: Changing the shortcode to
[wp_dt]. Backward compatibility is supported and old shortcodes will still work but the use of the new one everywhere is strongly recommended.
- Modified: Changing the
start. Backward compatibility is supported the old
initattribute but the use of the new
startattribute everywhere is strongly recommended.
- Other: Preparation for the next 3.0 major update.
- 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
- Improved: There is only one
zeroattribute 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-monthworks even when PHP on server is complied without –enable-calendar option.
- Other: WordPress 5.3.2 compatibility.
- Added: Shortcode item
- Added: Shortcode duplicate/alias item
nextattribute 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.
week-of-yearitem not showing correctly.
- Framework update and bug fixes.
- Added: Denra Plugins Framework 1.0.
- Added: Feature to set the
initattribute from page/post creation or modification time.
- Added: Shorter version for the
_changeattributes removing the
- Added: More shortcodes for easier and faster use by missing the
- Fixed: A couple of bug fixes after the initial release
- Initial release