Plugin / WP Date and Time Shortcode

Denra.com aka SoftShop Ltd

Description

Description

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 week of the year.
  • Show the day 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.
  • Set post/page creation or modification time (including GMT variants) as “init” attribute.
  • Add or subtract years, months, days, hours, minutes and/or seconds before showing the final result.

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:
    • datetime – default WP date and time format (default value)
    • date – default WP date format
    • time – default WP date 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 full 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
  • i18n – set months and weeks names to be displayed in the current language
  • 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-datetime]
  • [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-weekday]
  • [wp-dt-weekday-name]
  • [wp-dt-weekday-name-short]
  • [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

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

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 a timezone and timezone abbreviation:
[wp-dt-timezone] => Europe/Sofia
[wp-dt-timezone-abbreviation] => Т

Ratings

5
1 reviews

Rating breakdown

Details Information

Version

2.1.1

First Released

17 Sep, 2019

Total Downloads

587

Wordpress Version

4.0 or higher

Tested up to:

5.3

Require PHP Version:

-

Tags

Contributors

Languages

The plugin hasn't been transalated in any language other than English.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.