API15

API15:JHTML/date

From Joomla! Documentation

Revision as of 22:18, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Returns formated date according to current local and adds time offset <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JHTML/date|Ed...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Returns formated date according to current local and adds time offset

[Edit Descripton]

Template:Description:JHTML/date

Syntax

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

string formated date

Defined in

libraries/joomla/html/html.php

Importing

jimport( 'joomla.html.html' );

Source Body

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);
}

[Edit See Also] Template:SeeAlso:JHTML/date

Examples

<CodeExamplesForm />