Use this plugin if you want to display a current, past or future date or time that may or may not change during every new visit of the specific page or post. It takes lots of efforts to develop and support a plugin for free. Please send us your feedback and questions to fix your issue before leaving a bad....
Use this plugin if you want to display a current, past or future date or time that may or may not change during every new visit of the specific page or post.
It takes lots of efforts to develop and support a plugin for free. Please send us your feedback and questions to fix your issue before leaving a bad review.
WARNING: If you are using a caching plugin you may need to exclude the page or post from it so the content may be generated dynamically with every single visit.
Please see the description and the F.A.Q. section below, or contact us by e-mail if you need more information or support.
Features
- Show date and time in the default WordPress or customer format.
- Show separately date only or time only.
- Show separately 4 or 2-digit year.
- Show month as number, full name (e.g January) or three letters (e.g. Jan).
- 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, full name (e.g. Monday) or three letters (e.g. Mon).
- Show the day of the year.
- Show the week of the year.
- Show the number of days for the month.
- Show the number of days in February for the year.
- Show timezone and timezone abbreviation.
- Show any combinations for date and time using the built-in PHP date() function format.
- Show any item based on 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.
Shortcode/s and attributes
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, datetime – default WP date and time format (default value)
date – default WP date format
time – default WP time format
custom – custom format used by the built-in PHP date() function
year, years – 4-digit year
year-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”)
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
1–31 – 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 (‘on’ by default)
months_zero – set leading zero for months
days_zero – set leading zero for days
days_suffix – set suffix st, nd, rd, th for days
hours_zero – set leading zero for hours
hours_24 – set 24 or 12 hours format
minutes_zero – set leading zeros for minutes
seconds_zero – set leading zeros for seconds
am_pm – used when 12 hours format is preferred: “L” for lowercase (am, pm) or “U” for uppercase (AM, PM)
years, years_change – change in years
months, months_change – change in months
days, days_change – change in days
hours, hours_change – change in hours
minutes, minutes_change – change in minutes
seconds, seconds_change – change in seconds
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]
Shortcode/s usage examples
Examples of the shortcode/s usage with a variety of attributes and the results
- For the examples a random creation date and time are used (2019-09-16 17:45:53 i.e. Sep 16, 2019 17:45:53)
- The examples are in the following display format:
[shortcode sample] => visible result.
Show current date and time in default WordPress format:
[wp-dt] => 16/09/2019 17:45
or [wp-dt item="date-time"] => 16/09/2019 17:45
or [wp-dt-date-time] => 16/09/2019 17:45
(The default WordPress date and time format is used.)
Show current date only in the default WordPress format:
[wp-dt item=”date”] => 16/09/2019
or [wp-dt-date] => 16/09/2019
Show current time only in the default WordPress format:
[wp-dt item=”time”] => 17:45
or [wp-dt-time] => 17:45
Show current date and time with custom format:
[wp-dt-custom format=”d F Y, H:i A”] => 16 September 2019, 17:45 PM
Show the time 3 years, 4 months, 5 days, 6 hours, 20 minutes and 30 seconds ago starting from a specific date:
[wp-dt-custom format=”M j, Y H:i:s a” init=”2019-09-16 17:45:53″ years=”-3″ months=”-4″ days=”-5″ hours=”-6″ minutes=”-20″ seconds=”-30″] => May 11, 2016 11:25:23 am
Show post/page creation and modification date and time in European format:
[wp-dt-custom init=”post-created” format=”j.n.Y G:i”] => 25.6.2019 9:14
[wp-dt-custom init=”post-modified” format=”j.n.Y G:i”] => 14.8.2019 14:48
Show 4 and 2-digit year, month and day of month:
[wp-dt-year] => 2019
[wp-dt-year-short years=”+2″] => 21
[wp-dt-month months=”+1″] => 10
[wp-dt-day days=”-1″ days_zero=”no”] => 15
[wp-dt-day days_zero=”no” days_suffix=”yes”] => 16th
Show month name (previous, this, and next month):
[wp-dt-month-name months=”-1″] => August
[wp-dt-month-name] => September
[wp-dt-month-name months=”+1″] => October
Show month short three letter name (previous, this, and next month):
[wp-dt-month-name-short months=”-1″] => Aug
[wp-dt-month-name-short] => Sep
[wp-dt-month-name-short months=”+1″] => Oct
Show week of the year, day of the year, days in the month, days in February for the year:
[wp-dt-week-of-year] => 38
[wp-dt-day-of-year] => 259
[wp-dt-days-in-month] => 30
[wp-dt-days-in-february] => 28
[wp-dt-days-in-year] => 365
Show weekday as number, full name or three letter name:
[wp-dt-weekday] => 1
[wp-dt-weekday-name] => Monday
[wp-dt-weekday-name-short] => Mon
Show hours, minutes, seconds and am/pm:
[wp-dt-hours hours_24=”no” hours_zero=”no”]:[wp-dt-minutes]:[wp-dt-seconds] [wp-dt item=”am-pm”] => 5:45:53 pm
or much shorter if you can use the PHP date() function format characters
[wp-dt-custom format=”g:i:s a”]` => 5:45:53 pm
Show next day, weekday, or last day of month from a list (weekly or monthly repeating dates).
[wp-dt-custom format=”D, M j – H:i” next=”Fri 19:30″] => Sep 20 19:30
[wp-dt-date-time next=”Sat 10:00, Sun 11:00″] => 21/09/2019 10:00
[wp-dt-date-time next=”1, 14, 20, tue 18:00, thu 18:00, last-day-of-month”] => 17/09/2019 18:00
[wp-dt-custom format=”d M H a” next=”5 10:00, 10 11:00, 15 10:30, 20 10:30, 25 10:40, 30″] => 20 Sep, 10 am
Be Part of the Conversation with WordPress Enthusiasts
Using WP Date and Time Shortcod...? Great, join the conversation now!
Let’s talk about overall quality, ease of use, stellar support, unbeatable value, and the amazing experience WP Date and Time Shortcod... brings to you.