Current Date Free

Version: 2.0

A lightweight plugin that provides shortcodes for the current, Year, Month, Day, Time and more.

How to Use

Basic Structure

Insert [lwcd display="format(s)"], replacing format(s) with the desired output from the available formats below.


Multiple Formats in One Shortcode

Inserting [lwcd display="F jS"] would output F full text of the month, then a space, then j day of the month - no zero, then S day of the month suffix.

Example: Today is June 13th


Multiple Formats in One Shortcode with Text

Inserting [lwcd display="h:i:s A"] would output hour:minuite:second space capital AM/PM. The colons output as the character they are.

Example: The time is 04:51:42 AM>


Multiple Formats in One Shortcode with Conflicting Text

Inserting [lwcd display="Today is the z day of o."] would output jibberish since some of the letters are also recognised formats. You must tell the shortcode not to convert the letter to a date, time, etc but print them as text. To flag the letter as text, insert a \ before each letter. For simplicity, you can do them all except the ones needed. Another options would be to use two shortcodes.

Example: [lwcd display="Today is the z day of o."] would output UTC202113am21 5142 3004UTC 163 13am21 2021f 2021.

Example: [lwcd display="\T\o\d\a\y \i\s \t\h\e z \d\a\y \o\f o."] would output UTC20211321 5142 04UTC 163 1321 2021 2021.

Example: Today is the [lwcd display="z"] day of [lwcd display="o"]. would output Today is the [lwcd display="z"] day of [lwcd display="o"].

Available Formats

Day Formats

d - Day of the month, 2 digits with leading zeros, example 01 to 31
D - A text representation of a day, three letters, exmaple Mon through Sun
j - Day of the month without leading zeros, example 1 to 31
l - (lowercase ‘L’) A full text representation of the day of the week, example Sunday through Saturday
S - English suffix for the day of the month, 2 characters, example st, nd, rd or th.
w - Numeric representation of the day of the week, example 0 (for Sunday) through 6 (for Saturday)
z - The day of the year (starting from 0), example 0 through 365

Week Formats

W - Week number of year, weeks starting on Monday, example 42 (the 42nd week in the year)

Year Formats

L - Whether it’s a leap year, example 1 if it is a leap year, 0 otherwise.
Y - A four digit representation of a year, example 2004
y - A two digit representation of a year, example 04

Time Formats

a - Lowercase Ante meridiem and Post meridiem, example am or pm
A - Uppercase Ante meridiem and Post meridiem, example AM or PM
g - 12-hour format of an hour without leading zeros, example 1 through 12
G - 24-hour format of an hour without leading zeros, example 0 through 23
h - 12-hour format of an hour with leading zeros, example 01 through 12
H - 24-hour format of an hour with leading zeros, example 00 through 23
i - Minutes with leading zeros, example 00 to 59
s - Seconds, with leading zeros, example 00 through 59

Timezone

e - Timezone identifier, example UTC, GMT, Atlantic/Azores
I - (capital i)Whether or not the date is in daylight saving time, example 1 if Daylight Saving Time, 0 otherwise.
O - Difference to Greenwich time (GMT) in hours, example +0200
P - Difference to Greenwich time (GMT) with colon, example +02:00
T - Timezone abbreviation, example EST, MDT

Full Date/Time

c - ISO 8601 formatted date, example 2004-02-12T15:19:21+00:00
r - RFC 2822 formatted date, examlpe Thu, 21 Dec 2000 16:01:07 +0200
U - Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT), example

Official vs Minified

Official

This is the official version found within the WordPress repository. It includes all WordPress required files, will receive update notifications through your WordPress Dashboard, and includes a help page in the Dashboard Settings.

Minified

This build contains the identical font-end functionality and uses the same shortcodes as the Repository build but has been stripped down to just the minimum. Code contains minimal WordPress required comments, no Dashboard admin page, no unnecessary line breaks or spaces.