jjpmann / ee-dt
The DT Plugin displays dates with formatting and allows you to add days, months, years to the current date or a static date you set.
Requires
- php: >=5.3.10
- composer/installers: >=1.1.0
This package is auto-updated.
Last update: 2024-11-14 00:54:51 UTC
README
Date/Time plugin for ExpressionEngine
The DT Plugin displays dates with formatting and allows you to add days, months, years to the current date or a static date you set.
Installation
New: composer installer
composer require jjpmann/ee-dt
Read more about this here
Old: manual
move files into 'dt' folder inside of system/user/addons
Usage
{exp:dt}
Will return the date formatted this way: MM/DD/YYYY
{exp:dt:wrap}
Tag pair used to wrap around entries loop to adding custom dates in to parameters
Parameters
All of these are optional
set
Sets the static date that the other parameters will reference. If not set will default to the current date.
{exp:dt set="01/01/2010"}
format
Sets the format of the returned date using the following parameters: http://expressionengine.com/user_guide/templates/date_variable_formatting.html
{exp:dt set="11/03/90" ee_format="true" format="%l %M %j, %Y"}
Outputs: Saturday Nov 3, 1990
ee_format
if set to 'false'dt will parse the date using php formating: http://php.net/manual/en/function.strftime.php
{exp:dt set="11/03/90" format="%A %B %e, %Y"}
Outputs: Saturday November 3, 1990
language
Translates based on system languages
-
fr_FR : French
-
es_ES : Spanish
-
nl_NL : Dutch
{exp:dt set="11/03/90" language="es_ES" format="%A %b %e, %Y"}
Outputs: sábado noviembre 3, 1990
day
Adds or subtracts a value in days to current/set date.
month
Adds or subtracts a value in months to current/set date.
year
Adds or subtracts a value in years to current/set date.
{exp:dt day="3" month="1" year="-1" set="1/1/2010"}
Outputs: 02/04/09
hour
Adds or subtracts a value in hours to current/set date.
minute
Adds or subtracts a value in minutes to current/set date.
second
Adds or subtracts a value in seconds to current/set date.
Examples
Third Saturday of each month
Now: {current_time format="%m/%d/%y"} <br>
{exp:dt set='third saturday of this month'} == {current_time format="%m/%d/%y"}<br>
{if '{exp:dt set="first monday of this month"}' == '{current_time format="%m/%d/%y"}'}
YAY
{/if}