Liste de tous les membres
Fonctions membres publiques statiques |
static | getInstance ($date= 'now', $tz=null) |
Attributs publics statiques |
static | $format = 'Y-m-d H:i:s' |
Attributs protégés statiques |
static | $gmt |
static | $stz |
Description détaillée
Définition à la ligne 33 du fichier date.php.
Documentation des constructeurs et destructeur
JDate::__construct |
( |
|
$date = 'now' , |
|
|
|
$tz = null |
|
) |
| |
Constructor.
- Paramètres:
-
string | $date | String in a format accepted by strtotime(), defaults to "now". |
mixed | $tz | Time zone to be used for the date. Might be a string or a DateTimeZone object. |
- Depuis:
- 11.1
Définition à la ligne 81 du fichier date.php.
{
if (empty(self::$gmt) || empty(self::$stz))
{
self::$gmt = new DateTimeZone('GMT');
self::$stz = new DateTimeZone(@date_default_timezone_get());
}
if (!(
$tz instanceof DateTimeZone))
{
{
}
{
}
}
date_default_timezone_set('UTC');
$date = is_numeric($date) ? date('c', $date) : $date;
date_default_timezone_set(self::$stz->getName());
}
Documentation des fonctions membres
Magic method to access properties of the date given by class to the format method.
- Paramètres:
-
string | $name | The name of the property. |
- Renvoie:
- mixed A value if the property name is valid, null otherwise.
- Depuis:
- 11.1
Définition à la ligne 126 du fichier date.php.
{
$value = null;
switch ($name)
{
case 'daysinmonth':
$value = $this->
format(
't',
true);
break;
case 'dayofweek':
$value = $this->
format(
'N',
true);
break;
case 'dayofyear':
$value = $this->
format(
'z',
true);
break;
case 'isleapyear':
$value = (boolean) $this->
format(
'L',
true);
break;
case 'day':
$value = $this->
format(
'd',
true);
break;
case 'hour':
$value = $this->
format(
'H',
true);
break;
case 'minute':
$value = $this->
format(
'i',
true);
break;
case 'second':
$value = $this->
format(
's',
true);
break;
case 'month':
$value = $this->
format(
'm',
true);
break;
case 'ordinal':
$value = $this->
format(
'S',
true);
break;
case 'week':
$value = $this->
format(
'W',
true);
break;
case 'year':
$value = $this->
format(
'Y',
true);
break;
default:
$trace = debug_backtrace();
trigger_error(
'Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'],
E_USER_NOTICE
);
}
return $value;
}
Magic method to render the date object in the format specified in the public static member JDate::$format.
- Renvoie:
- string The date as a formatted string.
- Depuis:
- 11.1
Définition à la ligne 199 du fichier date.php.
JDate::calendar |
( |
|
$format, |
|
|
|
$local = false , |
|
|
|
$translate = true |
|
) |
| |
Gets the date as a formatted string in a local calendar.
- Paramètres:
-
string | $format | The date format specification string (see PHP_MANUAL#date) |
boolean | $local | True to return the date string in the local time zone, false to return it in GMT. |
boolean | $translate | True to translate localised strings |
- Renvoie:
- string The date string in the specified format format.
- Depuis:
- 11.1
Définition à la ligne 261 du fichier date.php.
JDate::dayToString |
( |
|
$day, |
|
|
|
$abbr = false |
|
) |
| |
Translates day of week number to a string.
- Paramètres:
-
integer | $day | The numeric day of the week. |
boolean | $abbr | Return the abbreviated day string? |
- Renvoie:
- string The day of the week.
- Depuis:
- 11.1
Définition à la ligne 229 du fichier date.php.
Références JText\_().
{
switch ($day)
{
case 0:
case 1:
return $abbr ? JText::_(
'MON') :
JText::_(
'MONDAY');
case 2:
return $abbr ? JText::_(
'TUE') :
JText::_(
'TUESDAY');
case 3:
return $abbr ? JText::_(
'WED') :
JText::_(
'WEDNESDAY');
case 4:
return $abbr ? JText::_(
'THU') :
JText::_(
'THURSDAY');
case 5:
return $abbr ? JText::_(
'FRI') :
JText::_(
'FRIDAY');
case 6:
return $abbr ? JText::_(
'SAT') :
JText::_(
'SATURDAY');
}
}
JDate::format |
( |
|
$format, |
|
|
|
$local = false , |
|
|
|
$translate = true |
|
) |
| |
Gets the date as a formatted string.
- Paramètres:
-
string | $format | The date format specification string (see PHP_MANUAL#date) |
boolean | $local | True to return the date string in the local time zone, false to return it in GMT. |
boolean | $translate | True to translate localised strings |
- Renvoie:
- string The date string in the specified format format.
- Depuis:
- 11.1
Définition à la ligne 277 du fichier date.php.
{
if ($translate)
{
$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 ($local == false)
{
}
if ($translate)
{
if (strpos($return, self::DAY_ABBR) !== false)
{
$return = str_replace(self::DAY_ABBR, $this->
dayToString(parent::format(
'w'),
true), $return);
}
if (strpos($return, self::DAY_NAME) !== false)
{
$return = str_replace(self::DAY_NAME, $this->
dayToString(parent::format(
'w')), $return);
}
if (strpos($return, self::MONTH_ABBR) !== false)
{
$return = str_replace(self::MONTH_ABBR, $this->
monthToString(parent::format(
'n'),
true), $return);
}
if (strpos($return, self::MONTH_NAME) !== false)
{
$return = str_replace(self::MONTH_NAME, $this->
monthToString(parent::format(
'n')), $return);
}
}
if ($local == false)
{
}
return $return;
}
static JDate::getInstance |
( |
|
$date = 'now' , |
|
|
|
$tz = null |
|
) |
| |
|
static |
Proxy for new JDate().
- Paramètres:
-
string | $date | String in a format accepted by strtotime(), defaults to "now". |
mixed | $tz | Time zone to be used for the date. |
- Renvoie:
- JDate
- Depuis:
- 11.3
Définition à la ligne 214 du fichier date.php.
JDate::getOffsetFromGMT |
( |
|
$hours = false | ) |
|
Get the time offset from GMT in hours or seconds.
- Paramètres:
-
boolean | $hours | True to return the value in hours. |
- Renvoie:
- float The time offset from GMT either in hours or in seconds.
- Depuis:
- 11.1
Définition à la ligne 338 du fichier date.php.
{
return (float) $hours ? ($this->tz->getOffset($this) / 3600) : $this->tz->getOffset($this);
}
JDate::monthToString |
( |
|
$month, |
|
|
|
$abbr = false |
|
) |
| |
Translates month number to a string.
- Paramètres:
-
integer | $month | The numeric month of the year. |
boolean | $abbr | If true, return the abbreviated month string |
- Renvoie:
- string The month of the year.
- Depuis:
- 11.1
Définition à la ligne 353 du fichier date.php.
Références JText\_().
{
switch ($month)
{
case 1:
case 2:
return $abbr ? JText::_(
'FEBRUARY_SHORT') :
JText::_(
'FEBRUARY');
case 3:
return $abbr ? JText::_(
'MARCH_SHORT') :
JText::_(
'MARCH');
case 4:
return $abbr ? JText::_(
'APRIL_SHORT') :
JText::_(
'APRIL');
case 5:
return $abbr ? JText::_(
'MAY_SHORT') :
JText::_(
'MAY');
case 6:
return $abbr ? JText::_(
'JUNE_SHORT') :
JText::_(
'JUNE');
case 7:
return $abbr ? JText::_(
'JULY_SHORT') :
JText::_(
'JULY');
case 8:
return $abbr ? JText::_(
'AUGUST_SHORT') :
JText::_(
'AUGUST');
case 9:
return $abbr ? JText::_(
'SEPTEMBER_SHORT') :
JText::_(
'SEPTEMBER');
case 10:
return $abbr ? JText::_(
'OCTOBER_SHORT') :
JText::_(
'OCTOBER');
case 11:
return $abbr ? JText::_(
'NOVEMBER_SHORT') :
JText::_(
'NOVEMBER');
case 12:
return $abbr ? JText::_(
'DECEMBER_SHORT') :
JText::_(
'DECEMBER');
}
}
JDate::setTimezone |
( |
|
$tz | ) |
|
JDate::toISO8601 |
( |
|
$local = false | ) |
|
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ètres:
-
boolean | $local | True to return the date string in the local time zone, false to return it in GMT. |
- Renvoie:
- string The date string in ISO 8601 format.
11.1
Définition à la ligne 412 du fichier date.php.
{
return $this->
format(DateTime::RFC3339, $local,
false);
}
JDate::toRFC822 |
( |
|
$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ètres:
-
boolean | $local | True to return the date string in the local time zone, false to return it in GMT. |
- Renvoie:
- string The date string in RFC 822 format.
11.1
Définition à la ligne 449 du fichier date.php.
{
return $this->
format(DateTime::RFC2822, $local,
false);
}
Gets the date as an SQL datetime string.
- Paramètres:
-
boolean | $local | True to return the date string in the local time zone, false to return it in GMT. |
JDatabaseDriver | $db | The database driver or null to use JFactory::getDbo() |
- Renvoie:
- string The date string in SQL datetime format.
11.4
Définition à la ligne 428 du fichier date.php.
Références JFactory\getDbo().
{
if ($db === null)
{
}
}
Gets the date as UNIX time stamp.
- Renvoie:
- integer The date as a UNIX timestamp.
- Depuis:
- 11.1
Définition à la ligne 461 du fichier date.php.
Documentation des données membres
JDate::$format = 'Y-m-d H:i:s' |
|
static |
const JDate::DAY_ABBR = "\x021\x03" |
const JDate::DAY_NAME = "\x022\x03" |
const JDate::MONTH_ABBR = "\x023\x03" |
const JDate::MONTH_NAME = "\x024\x03" |
La documentation de cette classe a été générée à partir du fichier suivant :