[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Date/ -> Date.php (summary)

Joomla! Content Management System

Copyright: (C) 2006 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 471 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Date:: (14 methods):
  __construct()
  __get()
  __toString()
  getInstance()
  dayToString()
  calendar()
  format()
  getOffsetFromGmt()
  monthToString()
  setTimezone()
  toISO8601()
  toSql()
  toRFC822()
  toUnix()


Class: Date  - X-Ref

Date is a class that stores a date and provides logic to manipulate
and render that date in a variety of formats.

__construct($date = 'now', $tz = null)   X-Ref
Constructor.

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.

__get($name)   X-Ref
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.

__toString()   X-Ref
Magic method to render the date object in the format specified in the public
static member Date::$format.

return: string  The date as a formatted string.

getInstance($date = 'now', $tz = null)   X-Ref
Proxy for new Date().

param: string  $date  String in a format accepted by strtotime(), defaults to "now".
param: mixed   $tz    Time zone to be used for the date.
return: Date

dayToString($day, $abbr = false)   X-Ref
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.

calendar($format, $local = false, $translate = true)   X-Ref
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.

format($format, $local = false, $translate = true)   X-Ref
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.

getOffsetFromGmt($hours = false)   X-Ref
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.

monthToString($month, $abbr = false)   X-Ref
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.

setTimezone($tz)   X-Ref
Method to wrap the setTimezone() function and set the internal time zone object.

param: \DateTimeZone  $tz  The new \DateTimeZone object.
return: Date

toISO8601($local = false)   X-Ref
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.

toSql($local = false, DatabaseDriver $db = null)   X-Ref
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: DatabaseDriver  $db     The database driver or null to use Factory::getDbo()
return: string     The date string in SQL datetime format.

toRFC822($local = false)   X-Ref
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.

toUnix()   X-Ref
Gets the date as UNIX time stamp.

return: integer  The date as a UNIX timestamp.



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer