API15

JHTML/date: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 66: Line 66:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=date
  category=date
  category=JHTML
  category=JHTML
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 00:38, 25 March 2017

Description

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

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

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

Examples

Code Examples