Source for file date.php
Documentation is available at date.php
 * @package     Joomla.Platform  
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.  
 * @license     GNU General Public License version 2 or later; see LICENSE  
 * JDate is a class that stores a date and provides logic to manipulate  
 * and render that date in a variety of formats.  
 * @property-read  string   $daysinmonth   t - Number of days in the given month.  
 * @property-read  string   $dayofweek     N - ISO-8601 numeric representation of the day of the week.  
 * @property-read  string   $dayofyear     z - The day of the year (starting from 0).  
 * @property-read  boolean  $isleapyear    L - Whether it's a leap year.  
 * @property-read  string   $day           d - Day of the month, 2 digits with leading zeros.  
 * @property-read  string   $hour          H - 24-hour format of an hour with leading zeros.  
 * @property-read  string   $minute        i - Minutes with leading zeros.  
 * @property-read  string   $second        s - Seconds with leading zeros.  
 * @property-read  string   $month         m - Numeric representation of a month, with leading zeros.  
 * @property-read  string   $ordinal       S - English ordinal suffix for the day of the month, 2 characters.  
 * @property-read  string   $week          W - Numeric representation of the day of the week.  
 * @property-read  string   $year          Y - A full numeric representation of a year, 4 digits.  
 * @package     Joomla.Platform  
class JDate extends DateTime  
     * The format string to be applied when using the __toString() magic method.  
    public static $format = 
'Y-m-d H:i:s';  
     * Placeholder for a DateTimeZone object with GMT as the time zone.  
     * Placeholder for a DateTimeZone object with the default server  
     * time zone as the time zone.  
     * The DateTimeZone object for usage in rending dates as strings.  
     * @param   string  $date  String in a format accepted by strtotime(), defaults to "now".  
     * @param   mixed   $tz    Time zone to be used for the date. Might be a string or a DateTimeZone object.  
        // Create the base GMT and server time zone objects.  
        if (empty(self::$gmt) || 
empty(self::$stz))  
            self::$gmt = 
new DateTimeZone('GMT');  
        // If the time zone object is not set, attempt to build it.  
        if (!($tz instanceof 
DateTimeZone))  
                $tz = 
new DateTimeZone($tz);  
        // If the date is numeric assume a unix timestamp and convert it.  
        // Call the DateTime constructor.  
        parent::__construct($date, $tz);  
        // Reset the timezone for 3rd party libraries/extension that does not use JDate  
        // Set the timezone object for access later.  
     * Magic method to access properties of the date given by class to the format method.  
     * @param   string  $name  The name of the property.  
     * @return  mixed   A value if the property name is valid, null otherwise.  
    public function __get($name)  
                $value = 
$this->format('t', true);  
                $value = 
$this->format('N', true);  
                $value = 
$this->format('z', true);  
                $value = (boolean) 
$this->format('L', true);  
                $value = 
$this->format('d', true);  
                $value = 
$this->format('H', true);  
                $value = 
$this->format('i', true);  
                $value = 
$this->format('s', true);  
                $value = 
$this->format('m', true);  
                $value = 
$this->format('S', true);  
                $value = 
$this->format('W', true);  
                $value = 
$this->format('Y', true);  
                    'Undefined property via __get(): ' . 
$name . 
' in ' . 
$trace[0]['file'] . 
' on line ' . 
$trace[0]['line'],  
     * Magic method to render the date object in the format specified in the public  
     * static member JDate::$format.  
     * @return  string  The date as a formatted string.  
        return (string) 
parent::format(self::$format);  
     * @param   string  $date  String in a format accepted by strtotime(), defaults to "now".  
     * @param   mixed   $tz    Time zone to be used for the date.  
    public static function getInstance($date = 
'now', $tz = 
null)  
        return new JDate($date, $tz);  
     * Translates day of week number to a string.  
     * @param   integer  $day   The numeric day of the week.  
     * @param   boolean  $abbr  Return the abbreviated day string?  
     * @return  string  The day of the week.  
     * Gets the date as a formatted string in a local calendar.  
     * @param   string   $format     The date format specification string (see {@link PHP_MANUAL#date})  
     * @param   boolean  $local      True to return the date string in the local time zone, false to return it in GMT.  
     * @param   boolean  $translate  True to translate localised strings  
     * @return  string   The date string in the specified format format.  
    public function calendar($format, $local = 
false, $translate = 
true)  
        return $this->format($format, $local, $translate);  
     * Gets the date as a formatted string.  
     * @param   string   $format     The date format specification string (see {@link PHP_MANUAL#date})  
     * @param   boolean  $local      True to return the date string in the local time zone, false to return it in GMT.  
     * @param   boolean  $translate  True to translate localised strings  
     * @return  string   The date string in the specified format format.  
    public function format($format, $local = 
false, $translate = 
true)  
            // Do string replacements for date format options that can be translated.  
            $format = 
preg_replace('/(^|[^\\\])D/', "\\1" . 
self::DAY_ABBR, $format);  
            $format = 
preg_replace('/(^|[^\\\])l/', "\\1" . 
self::DAY_NAME, $format);  
            $format = 
preg_replace('/(^|[^\\\])M/', "\\1" . 
self::MONTH_ABBR, $format);  
            $format = 
preg_replace('/(^|[^\\\])F/', "\\1" . 
self::MONTH_NAME, $format);  
        // If the returned time should not be local use GMT.  
            parent::setTimezone(self::$gmt);  
        $return = 
parent::format($format);  
            // Manually modify the month and day strings in the formatted time.  
            if (strpos($return, self::DAY_ABBR) !== 
false)  
            if (strpos($return, self::DAY_NAME) !== 
false)  
            if (strpos($return, self::MONTH_ABBR) !== 
false)  
            if (strpos($return, self::MONTH_NAME) !== 
false)  
            parent::setTimezone($this->tz);  
     * Get the time offset from GMT in hours or seconds.  
     * @param   boolean  $hours  True to return the value in hours.  
     * @return  float  The time offset from GMT either in hours or in seconds.  
        return (float) 
$hours ? 
($this->tz->getOffset($this) / 
3600) : 
$this->tz->getOffset($this);  
     * Translates month number to a string.  
     * @param   integer  $month  The numeric month of the year.  
     * @param   boolean  $abbr   If true, return the abbreviated month string  
     * @return  string  The month of the year.  
                return $abbr ? 
JText::_('JANUARY_SHORT') : 
JText::_('JANUARY');  
                return $abbr ? 
JText::_('FEBRUARY_SHORT') : 
JText::_('FEBRUARY');  
                return $abbr ? 
JText::_('AUGUST_SHORT') : 
JText::_('AUGUST');  
                return $abbr ? 
JText::_('SEPTEMBER_SHORT') : 
JText::_('SEPTEMBER');  
                return $abbr ? 
JText::_('OCTOBER_SHORT') : 
JText::_('OCTOBER');  
                return $abbr ? 
JText::_('NOVEMBER_SHORT') : 
JText::_('NOVEMBER');  
                return $abbr ? 
JText::_('DECEMBER_SHORT') : 
JText::_('DECEMBER');  
     * Method to wrap the setTimezone() function and set the internal time zone object.  
     * @param   DateTimeZone  $tz  The new DateTimeZone object.  
     * @note    This method can't be type hinted due to a PHP bug: https://bugs.php.net/bug.php?id=61483  
        return parent::setTimezone($tz);  
     * Gets the date as an ISO 8601 string.  IETF RFC 3339 defines the ISO 8601 format  
     * and it can be found at the IETF Web site.  
     * @param   boolean  $local  True to return the date string in the local time zone, false to return it in GMT.  
     * @return  string  The date string in ISO 8601 format.  
     * @link    http://www.ietf.org/rfc/rfc3339.txt  
        return $this->format(DateTime::RFC3339, $local, false);  
     * Gets the date as an SQL datetime string.  
     * @param   boolean          $local  True to return the date string in the local time zone, false to return it in GMT.  
     * @param   JDatabaseDriver  $db     The database driver or null to use JFactory::getDbo()  
     * @return  string     The date string in SQL datetime format.  
     * @link    http://dev.mysql.com/doc/refman/5.0/en/datetime.html  
    public function toSql($local = 
false, JDatabaseDriver $db = 
null)  
        return $this->format($db->getDateFormat(), $local, false);  
     * Gets the date as an RFC 822 string.  IETF RFC 2822 supercedes RFC 822 and its definition  
     * can be found at the IETF Web site.  
     * @param   boolean  $local  True to return the date string in the local time zone, false to return it in GMT.  
     * @return  string   The date string in RFC 822 format.  
     * @link    http://www.ietf.org/rfc/rfc2822.txt  
    public function toRFC822($local = 
false)  
        return $this->format(DateTime::RFC2822, $local, false);  
     * Gets the date as UNIX time stamp.  
     * @return  integer  The date as a UNIX timestamp.  
        return (int) 
parent::format('U');  
 
 
	
		Documentation generated on Tue, 19 Nov 2013 14:57:55 +0100 by phpDocumentor 1.4.3