Documentation
Thanks for choosing my plugin, I am updating and maintaining it based on my time and effort!
Date counter – is just a 9 kilobytes WordPress plugin.
Easily display the current date or calculate the difference between two dates.
- Version: 2.0
- Author: Pankratov Konstantin
- Created: Sometime in 2019
- Update: 6 July, 2021
If you have any question or need some help, Please feel free to contact via Support forum.
Installation
Follow the steps below to setup your site template:
- Upload the plugin files to the /wp-content/plugins/date-counter directory, or install the plugin through the WordPress plugins screen directly..
- Activate the plugin through the ‘Plugins’ screen in WordPress.
- Use following shortcodes:
[CurrentDatetime format=""]
- Displays current date & time in different formats.[DatetimeDifference startDate="" endDate="" format=""]
- Calculates difference between two dates and displays it in different formats.
Current date & time
Displays current date & time in different formats.
Current date & time: [CurrentDatetime format="d/m/Y H:i"]
Current date & time: 05.07.2021 12:48
Format options:
Day
Character | Description | Return value |
---|---|---|
d | Numeric representation with leading zeros | 01 to 31 |
j | Numeric representation without leading zeros | 1 to 31 |
l (lowercase L) |
Full textual representation | Monday to Sunday |
D | Short textual representation | Mon to Sun |
S | English ordinal suffix for the day. Works well with j. | st, nd, rd or th |
z | Day of the year | 0 to 365 |
Week
Character | Description | Return value |
---|---|---|
W | Numeric representation with leading zeros | 01 to 53 |
Month
Character | Description | Return value |
---|---|---|
m | Numeric representation with leading zeros | 01 to 12 |
n | Numeric representation without leading zeros | 1 to 12 |
F | Full textual representation | January to December |
M | Short textual representation | Jan to Dec |
l (lowercase L) |
Number of days in the current month | 28 to 31 |
Year
Character | Description | Return value |
---|---|---|
Y | 4-digit representation | 1999, 2001, 2021 |
y | 2-digit representation | 99, 01, 21 |
Hours
Character | Description | Return value |
---|---|---|
g | 12-hour format without leading zeros | 1 to 12 |
G | 24-hour format without leading zeros | 0 to 23 |
h | 12-hour format with leading zeros | 01 to 12 |
H | 24-hour format with leading zeros | 00 to 23 |
a | Lowercase Ante meridiem and Post meridiem | am, pm |
A | Uppercase Ante meridiem and Post meridiem | AM, PM |
Minutes
Character | Description | Return value |
---|---|---|
i | Numeric representation with leading zeros | 00 to 59 |
Seconds
Character | Description | Return value |
---|---|---|
s | Numeric representation with leading zeros | 00 to 59 |
Timezone
Character | Description | Return value |
---|---|---|
e | Timezone identifier | Examples: UTC, GMT, Atlantic/Azores |
T | Timezone abbreviation | Examples: EST, MDT |
P | Difference to Greenwich time (GMT) | Examples: +02:00, +03:00 |
Usage:
-
[CurrentDatetime format="jS F, Y"]
6th July, 2021
-
It's
[CurrentDatetime format="g:i A (e)"]
It's 10:35 AM (UTC)
Date & time difference
Calculates difference between two dates and displays it in different formats.
I'm [DatetimeDifference startDate="1998-08-25" endDate="now" format="Y"]
years old.
I'm 23 years old.
StartDate & endDate options:
Format | Description | Example |
---|---|---|
NOW | To set current date & time | now |
DD.MM.YYYY DD-MM-YYYY YYYY.MM.DD YYYY-MM-DD |
Date format |
31.01.1991 31-01-1991 1991.01.31 1991-01-31 |
DD.MM.YYYY hh:mm:ss DD-MM-YYYY hh:mm:ss YYYY.MM.DD hh:mm:ss YYYY-MM-DD hh:mm:ss |
Date format with time |
31.01.1991 12:59:59 31-01-1991 12:59:59 1991.01.31 12:59:59 1991-01-31 12:59:59 |
Format options:
Day
Character | Description | Return value |
---|---|---|
D | Numeric representation with leading zeros | 01, 03, 31 |
d | Numeric representation without leading zeros | 1, 3, 31 |
a | Total number of days between dates | 1, 17, 3871 |
Month
Character | Description | Return value |
---|---|---|
M | Numeric representation with leading zeros | 01, 03, 12 |
m | Numeric representation without leading zeros | 1, 3, 12 |
Year
Character | Description | Return value |
---|---|---|
Y | Numeric representation with leading zeros | 01, 03, 137 |
y | Numeric representation without leading zeros | 1, 3, 137 |
Hours
Character | Description | Return value |
---|---|---|
H | Numeric representation with leading zeros | 01, 03, 23 |
h | Numeric representation without leading zeros | 1, 3, 23 |
Minutes
Character | Description | Return value |
---|---|---|
I | Numeric representation with leading zeros | 01, 03, 59 |
i | Numeric representation without leading zeros | 1, 3, 59 |
Seconds
Character | Description | Return value |
---|---|---|
S | Numeric representation with leading zeros | 01, 03, 59 |
s | Numeric representation without leading zeros | 1, 3, 59 |
Usage:
-
[DatetimeDifference startDate="31.12.2020" endDate="now" format="a"]
days have passed since the new year.187 days have passed since the new year.
-
Tomorrow's trip at 14:35 (2:35 PM) starts in
[DatetimeDifference startDate="now" endDate="07.07.2021 14:35" format="h hours & i minutes"]
.Tomorrow's trip at 14:35 (2:35 PM) starts in 8 hours & 34 minutes.
Total date & time difference
Calculates the total difference between two dates in years, months, weeks, days, hours, minutes and seconds.
The store will open in [TotalDatetimeDifference startDate="now" endDate="16.07.2021 8:00" format="i"]
today.
The store will open in 19 minutes today.
StartDate & endDate options:
Format | Description | Example |
---|---|---|
NOW | To set current date & time | now |
DD.MM.YYYY DD-MM-YYYY YYYY.MM.DD YYYY-MM-DD |
Date format |
31.01.1991 31-01-1991 1991.01.31 1991-01-31 |
DD.MM.YYYY hh:mm:ss DD-MM-YYYY hh:mm:ss YYYY.MM.DD hh:mm:ss YYYY-MM-DD hh:mm:ss |
Date format with time |
31.01.1991 12:59:59 31-01-1991 12:59:59 1991.01.31 12:59:59 1991-01-31 12:59:59 |
Format options:
Character | Description | Return value |
---|---|---|
y | Years | 1, 39, 9812, and so on. |
m | Months | 1, 39, 9812, and so on. |
w | Weeks | 1, 39, 9812, and so on. |
d | Days | 1, 39, 9812, and so on. |
h | Hours | 1, 39, 9812, and so on. |
i | Minutes | 1, 39, 9812, and so on. |
s | Seconds | 1, 39, 9812, and so on. |
Usage:
-
The store will open in
[TotalDatetimeDifference startDate="now" endDate="16.07.2021 8:00" format="i"]
today.The store will open in 19 minutes today.
-
[TotalDatetimeDifference startDate="now" endDate="25.08.2025" format="d"]
days left until my b-day.39 days left until my b-day.