API15

JHTML/date

From Joomla! Documentation

< API15:JHTML

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Returns formated date according to current local and adds time offset

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

date($date, $format=null, $offset=NULL)
Parameter Name Default Value Description
$date date in an US English date format
$format null format optional format for strftime
$offset NULL

Returns[edit]

string formated date

Defined in[edit]

libraries/joomla/html/html.php

Importing[edit]

jimport( 'joomla.html.html' );

Source Body[edit]

function date($date, $format = null, $offset = NULL)
{
        if ( ! $format ) {
                $format = JText::_('DATE_FORMAT_LC1');
        }



        if(is_null($offset))
        {
                $config =& JFactory::getConfig();
                $offset = $config->getValue('config.offset');
        }
        $instance =& JFactory::getDate($date);
        $instance->setOffset($offset);

        return $instance->toFormat($format);
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]