<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Proximate</id>
	<title>Joomla! Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Proximate"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Proximate"/>
	<updated>2026-10-15T03:46:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Modulelayout_form_field_type&amp;diff=1020696</id>
		<title>Modulelayout form field type</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Modulelayout_form_field_type&amp;diff=1020696"/>
		<updated>2024-02-16T12:07:04Z</updated>

		<summary type="html">&lt;p&gt;Proximate: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;modulelayout&#039;&#039;&#039; form field type provides a drop down list of all available layouts for a module, grouped by core and template.  If the parameter has a saved value this is selected when the page is first loaded.  If not, the default value (if any) is selected.&amp;lt;/translate&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&amp;lt;!--T:2--&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;type&#039;&#039;&#039; (mandatory) must be &#039;&#039;modulelayout&#039;&#039;.&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&amp;lt;!--T:3--&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;name&#039;&#039;&#039; (mandatory) is the unique name of the parameter.&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;label&#039;&#039;&#039; (mandatory) (translatable) is the descriptive title of the field.&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&amp;lt;!--T:5--&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;description&#039;&#039;&#039; (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:10--&amp;gt;&lt;br /&gt;
Combining following attributes enable you to provide a drop down list of layouts of a specific module.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;module&#039;&#039;&#039; (optional) is a specific module name (e.g. &#039;&#039;mod_articles_category&#039;&#039;).&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:12--&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;client_id&#039;&#039;&#039; (optional).&lt;br /&gt;
** If &#039;&#039;0&#039;&#039; (site): Forces searching for layouts only in directories &#039;&#039;/modules/[MODULENAME]/tmpl/&#039;&#039; and all &#039;&#039;/templates/[TEMPLATENAME]/html/[MODULENAME]/&#039;&#039;.&lt;br /&gt;
** If &#039;&#039;1&#039;&#039; (administrator): Forces searching for layouts only in directories &#039;&#039;/administrator/modules/[MODULENAME]/tmpl/&#039;&#039; and all &#039;&#039;/administrator/templates/[TEMPLATENAME]/html/[MODULENAME]/&#039;&#039;.&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;template&#039;&#039;&#039; (optional) is a template name (e.g. &#039;&#039;protostar&#039;&#039; or &#039;&#039;isis&#039;&#039;). If set forces searching for module template overrides only in this template.&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
Example XML parameter definition:&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;field name=&amp;quot;mymodulelayout&amp;quot; type=&amp;quot;modulelayout&amp;quot; label=&amp;quot;JFIELD_ALT_LAYOUT_LABEL&amp;quot; description=&amp;quot;JFIELD_ALT_MODULE_LAYOUT_DESC&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== Use Language Constants as Option Values ===&lt;br /&gt;
The layout values can be translated if a language constant has been defined in the correct format in the module or template.&lt;br /&gt;
&lt;br /&gt;
Within the module language file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
MOD_MYMODULE_LAYOUT_LIST=&amp;quot;My Option Label&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string &amp;quot;My Option Label&amp;quot; is displayed for the file / option &amp;quot;list.php&amp;quot; and not &amp;quot;list&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== See also === &amp;lt;!--T:7--&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
* [[S:MyLanguage/Standard form field types|List of standard form field types]]&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&amp;lt;translate&amp;gt;&amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
[[Category:Standard form field types]]&amp;lt;/translate&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Proximate</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=How_to_use_JDate&amp;diff=771675</id>
		<title>How to use JDate</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=How_to_use_JDate&amp;diff=771675"/>
		<updated>2020-12-17T20:51:10Z</updated>

		<summary type="html">&lt;p&gt;Proximate: Typo toSQL statt toUnix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
== Introduction == &amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
Joomla&#039;s Date class is a helper class, extended from PHP&#039;s DateTime class, which allows developers to handle date formatting more efficiently. The class allows developers to format dates for readable strings, MySQL interaction, UNIX timestamp calculation, and also provides helper methods for working in different timezones.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:21--&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Regarding the &amp;quot;JDate&amp;quot; class name:&#039;&#039;&#039; This page has been updated to utilise namespaced class names. `JDate`, `JApplication` and other similarly named classes you will see throughout the Joomla documentation are actually class aliases, maintained for legacy reasons. It is recommended to use namespaced access to Joomla classes, which will improve your development experience by providing better code hints and checks in your editor, leading to fewer errors. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:22--&amp;gt;&lt;br /&gt;
You can view the full list of aliased classes [https://github.com/joomla/joomla-cms/blob/staging/libraries/classmap.php in this file inside the Joomla codebase].&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
== Creating a Date Instance == &amp;lt;!--T:3--&amp;gt;&lt;br /&gt;
All of the date helper methods require an instance of the Date class. To begin, you must create one. A Date object may be created in two ways. One is the typical native method of simply creating a new instance:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Joomla\CMS\Date\Date;&lt;br /&gt;
&lt;br /&gt;
$date = new Date(); // Creates a new Date object equal to the current time.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
You may also create an instance using the static method defined in Date:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Joomla\CMS\Date\Date;&lt;br /&gt;
&lt;br /&gt;
$date = Date::getInstance(); // Alias of &#039;new Date();&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:5--&amp;gt;&lt;br /&gt;
There is no difference between these methods, as Date::getInstance simply creates a new instance of Date exactly like the first method shown.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
Alternatively, you may also retrieve the current date (as a Date object) from the Application object, by using:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Joomla\CMS\Factory;&lt;br /&gt;
&lt;br /&gt;
$date = Factory::getDate();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
== Arguments == &amp;lt;!--T:7--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
The Date constructor (and getInstance static method) accepts two optional parameters: A date string to format, and a timezone. Not passing a date string will create a Date object with the current date and time, while not passing a timezone will allow the Date object to use the default timezone set.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
The first argument, if used, should be a string that can be parsed using PHP&#039;s native DateTime constructor. E.g:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Joomla\CMS\Date\Date;&lt;br /&gt;
&lt;br /&gt;
$currentTime = new Date(&#039;now&#039;); // Current date and time&lt;br /&gt;
$tomorrowTime = new Date(&#039;now +1 day&#039;); // Current date and time, + 1 day.&lt;br /&gt;
$plus1MonthTime = new Date(&#039;now +1 month&#039;); // Current date and time, + 1 month.&lt;br /&gt;
$plus1YearTime = new Date(&#039;now +1 year&#039;); // Current date and time, + 1 year.&lt;br /&gt;
$plus1YearAnd1MonthTime = new Date(&#039;now +1 year +1 month&#039;); // Current date and time, + 1 year and 1 month.&lt;br /&gt;
$plusTimeToTime = new Date(&#039;now +1 hour +30 minutes +3 seconds&#039;); // Current date and time, + 1 hour, 30 minutes and 3 seconds&lt;br /&gt;
$plusTimeToTime = new Date(&#039;now -1 hour +30 minutes +3 seconds&#039;); // Current date and time, + 1 hour, 30 minutes and 3 seconds&lt;br /&gt;
$combinedTimeToTime = new Date(&#039;now -1 hour -30 minutes 23 seconds&#039;); // Current date and time, - 1 hour, +30 minutes and +23 seconds&lt;br /&gt;
&lt;br /&gt;
$date = new Date(&#039;2012-12-1 15:20:00&#039;); // 3:20 PM, December 1st, 2012&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:23--&amp;gt;&lt;br /&gt;
A Unix timestamp (in seconds) can also be passed as the first argument, in which case it will be internally uplifted into a date. If a timezone has been specified as the second argument to the constructor, it will be converted to that timezone.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
== Outputting Dates == &amp;lt;!--T:16--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:24--&amp;gt;&lt;br /&gt;
One note of caution when outputting Date objects in a user context: do not simply print them to the screen. The Date object&#039;s toString() method simply calls its parent&#039;s format() method, without consideration for timezones or localized date formatting. This will not result in a good user experience, and will lead to inconsistencies between the formatting in your extension, and elsewhere in Joomla. Instead, you should always output Dates using the methods shown below.&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== Common Date Formats === &amp;lt;!--T:25--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:26--&amp;gt;&lt;br /&gt;
A number of date formats are predefined in Joomla as part of the base language packs. This is beneficial because it means date formats can be easily internationalised. A sample of the available format strings is below, from the en-GB language pack. It is highly recommended to utilise these formatting strings when outputting dates, so that your dates will be automatically re-formatted according to a user&#039;s locale. They can be retrieved in the same way as any language string (see below for examples).&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
DATE_FORMAT_LC=&amp;quot;l, d F Y&amp;quot;&lt;br /&gt;
DATE_FORMAT_LC1=&amp;quot;l, d F Y&amp;quot;&lt;br /&gt;
DATE_FORMAT_LC2=&amp;quot;l, d F Y H:i&amp;quot;&lt;br /&gt;
DATE_FORMAT_LC3=&amp;quot;d F Y&amp;quot;&lt;br /&gt;
DATE_FORMAT_LC4=&amp;quot;Y-m-d&amp;quot;&lt;br /&gt;
DATE_FORMAT_LC5=&amp;quot;Y-m-d H:i&amp;quot;&lt;br /&gt;
DATE_FORMAT_LC6=&amp;quot;Y-m-d H:i:s&amp;quot;&lt;br /&gt;
DATE_FORMAT_JS1=&amp;quot;y-m-d&amp;quot;&lt;br /&gt;
DATE_FORMAT_CALENDAR_DATE=&amp;quot;%Y-%m-%d&amp;quot;&lt;br /&gt;
DATE_FORMAT_CALENDAR_DATETIME=&amp;quot;%Y-%m-%d %H:%M:%S&amp;quot;&lt;br /&gt;
DATE_FORMAT_FILTER_DATE=&amp;quot;Y-m-d&amp;quot;&lt;br /&gt;
DATE_FORMAT_FILTER_DATETIME=&amp;quot;Y-m-d H:i:s&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== The HtmlHelper Method (Recommended) === &amp;lt;!--T:27--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:28--&amp;gt;&lt;br /&gt;
As with many common output items, the HtmlHelper class is here to...help! HtmlHelper&#039;s date() method will take any date-time string that the Date constructor would accept, along with a formatting string, and output the date appropriately for the current user&#039;s timezone settings. As such, this is the recommended method for outputting dates for the user.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Joomla\CMS\HTML\HTMLHelper;&lt;br /&gt;
use Joomla\CMS\Language\Text;&lt;br /&gt;
&lt;br /&gt;
$myDateString = &#039;2012-12-1 15:20:00&#039;;&lt;br /&gt;
echo HtmlHelper::date($myDateString, Text::_(&#039;DATE_FORMAT_FILTER_DATETIME&#039;));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== The Date Object&#039;s format() Method === &amp;lt;!--T:29--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:30--&amp;gt;&lt;br /&gt;
Another option is to format the Date manually. If this method is used, you will have to also manually retrieve and set the user&#039;s timezone. This method is more useful for formatting dates outside of the user interface, such as in system logs or API calls.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Joomla\CMS\Language\Text;&lt;br /&gt;
use Joomla\CMS\Date\Date;&lt;br /&gt;
use Joomla\CMS\Factory;&lt;br /&gt;
&lt;br /&gt;
$myDateString = &#039;2012-12-1 15:20:00&#039;;&lt;br /&gt;
$timezone = Factory::getUser()-&amp;gt;getTimezone();&lt;br /&gt;
&lt;br /&gt;
$date = new Date($myDateString);&lt;br /&gt;
$date-&amp;gt;setTimezone($timezone);&lt;br /&gt;
echo $date-&amp;gt;format(Text::_(&#039;DATE_FORMAT_FILTER_DATETIME&#039;));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
== Other Useful Code Examples == &amp;lt;!--T:31--&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== Quickly Outputting the Current Time === &amp;lt;!--T:32--&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:18--&amp;gt;&lt;br /&gt;
There are two easy ways of doing this.&lt;br /&gt;
# The HtmlHelper&#039;s date() method, if no date value is provided, will default to the current time. &lt;br /&gt;
# Factory::getDate() gets the current date as a Date object, which we can then format.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Joomla\CMS\Factory;&lt;br /&gt;
use Joomla\CMS\HTML\HTMLHelper;&lt;br /&gt;
use Joomla\CMS\Language\Text;&lt;br /&gt;
&lt;br /&gt;
// These two are functionally equivalent&lt;br /&gt;
echo HtmlHelper::date(&#039;now&#039;, Text::_(&#039;DATE_FORMAT_FILTER_DATETIME&#039;));&lt;br /&gt;
&lt;br /&gt;
$timezone = Factory::getUser()-&amp;gt;getTimezone();&lt;br /&gt;
echo Factory::getDate()-&amp;gt;setTimezone($timezone)-&amp;gt;format(Text::_(&#039;DATE_FORMAT_FILTER_DATETIME&#039;));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== Adding and Subtracting from Dates === &amp;lt;!--T:33--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:34--&amp;gt;&lt;br /&gt;
Because the Joomla Date object extends the PHP DateTime object, it provides methods for adding and subtracting from dates. The easiest of these methods to use is the modify() method, which accepts any relative modification string that the PHP [https://www.php.net/manual/en/function.strtotime.php strtotime]() method would accept. For example:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Joomla\CMS\Date\Date;&lt;br /&gt;
&lt;br /&gt;
$date = new Date(&#039;2012-12-1 15:20:00&#039;);&lt;br /&gt;
$date-&amp;gt;modify(&#039;+1 year&#039;);&lt;br /&gt;
echo $date-&amp;gt;toSQL(); // 2013-12-01 15:20:00&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:35--&amp;gt;&lt;br /&gt;
There are also separate add() and sub() methods, for adding or subtracting time from a date object respectively. These accept PHP-standard [https://www.php.net/manual/en/class.dateinterval.php DateInterval] objects:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
use Joomla\CMS\Date\Date;&lt;br /&gt;
&lt;br /&gt;
$interval = new \DateInterval(&#039;P1Y1D&#039;); // Interval represents 1 year and 1 day&lt;br /&gt;
&lt;br /&gt;
$date1 = new Date(&#039;2012-12-1 15:20:00&#039;);&lt;br /&gt;
$date1-&amp;gt;add($interval);&lt;br /&gt;
echo $date1-&amp;gt;toSQL(); // 2013-12-02 15:20:00&lt;br /&gt;
&lt;br /&gt;
$date2 = new Date(&#039;2012-12-1 15:20:00&#039;);&lt;br /&gt;
$date2-&amp;gt;sub($interval);&lt;br /&gt;
echo $date2-&amp;gt;toSQL(); // 2011-11-30 15:20:00&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== Outputting Dates in ISO 8601 Format === &amp;lt;!--T:36--&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$date = new Date(&#039;2012-12-1 15:20:00&#039;);&lt;br /&gt;
$date-&amp;gt;toISO8601(); // 20121201T152000Z&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== Outputting Dates in RFC 822 Format === &amp;lt;!--T:37--&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$date = new Date(&#039;2012-12-1 15:20:00&#039;);&lt;br /&gt;
$date-&amp;gt;toRFC822(); // Sat, 01 Dec 2012 15:20:00 +0000&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== Outputting Dates in SQL Date-Time Format === &amp;lt;!--T:38--&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$date = new Date(&#039;20121201T152000Z&#039;);&lt;br /&gt;
$date-&amp;gt;toSQL(); // 2012-12-01 15:20:00&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
=== Outputting Dates as Unix Timestamps === &amp;lt;!--T:39--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:40--&amp;gt;&lt;br /&gt;
A Unix timestamp is expressed as the number of seconds that have passed since the Unix Epoch (the first second of Jan 1st 1970).&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$date = new Date(&#039;20121201T152000Z&#039;);&lt;br /&gt;
$date-&amp;gt;toUnix(); // 1354375200&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Proximate</name></author>
	</entry>
</feed>