JDate

From Joomla! Documentation
(Difference between revisions)
Jump to: navigation, search
m (Difference between to Dates)
m (bad link repair)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
===Availability===
+
This class is available in the following Joomla versions:-
{{JVer|1.5}}
+
<splist showpath=notparent />
 
+
<noinclude>[[Category:Platform JClasses]][[Category:JDate]]</noinclude>
===Defined in===
+
/libraries/joomla/utilities/date.php
+
 
+
===Extends===
+
* {{JVer|1.5}} [[JObject]]
+
* {{JVer|1.6}} [http://www.php.net/manual/en/class.datetime.php PHP DateTime]
+
 
+
===Importing===
+
<source lang="php">jimport( 'joomla.utilities.date' );</source>
+
 
+
===Examples===
+
====Difference between two Dates====
+
<source lang="php">
+
jimport( 'joomla.utilities.date' );
+
 
+
$datenow = new JDate();
+
$dateold = new JDate( $row->publish_down );
+
 
+
$row = // row from Database which publish_down as column e.g. #__content
+
 
+
if( $datenow->toUnix() > $dateold->toUnix() ) {
+
  echo "Actual";
+
} else {
+
  echo "Out of Date";
+
}
+
</source>
+

Latest revision as of 13:36, 29 August 2012

This class is available in the following Joomla versions:-

Personal tools
Namespaces

Variants
Actions
Navigation
Joomla! Sites
Toolbox