\JDate
JDate is a class that stores a date and provides logic to manipulate and render that date in a variety of formats.
Synopsis
class JDate
extends DateTime
{
- // constants
- const DAY_ABBR = "\x021\x03";
- const DAY_NAME = "\x022\x03";
- const MONTH_ABBR = "\x023\x03";
- const MONTH_NAME = "\x024\x03";
- // Inherited constants from DateTime
- const ATOM = "Y-m-d\TH:i:sP";
- const COOKIE = "l, d-M-y H:i:s T";
- const ISO8601 = "Y-m-d\TH:i:sO";
- const RFC822 = "D, d M y H:i:s O";
- const RFC850 = "l, d-M-y H:i:s T";
- const RFC1036 = "D, d M y H:i:s O";
- const RFC1123 = "D, d M Y H:i:s O";
- const RFC2822 = "D, d M Y H:i:s O";
- const RFC3339 = "Y-m-d\TH:i:sP";
- const RSS = "D, d M Y H:i:s O";
- const W3C = "Y-m-d\TH:i:sP";
- // methods
- public void __construct()
- public mixed __get()
- public string __toString()
- public static JDate getInstance()
- public string dayToString()
- public string calendar()
- public string format()
- public float getOffsetFromGMT()
- public string monthToString()
- public JDate setTimezone()
- public string toISO8601()
- public string toSql()
- public string toRFC822()
- public integer toUnix()
- // Inherited methods from DateTime
- public void __construct()
- public DateTime add()
- public DateTime createFromFormat()
- public array getLastErrors()
- public DateTime modify()
- public DateTime __set_state()
- public DateTime setDate()
- public DateTime setISODate()
- public DateTime setTime()
- public DateTime setTimestamp()
- public DateTime setTimezone()
- public DateTime sub()
- public DateInterval diff()
- public string format()
- public int getOffset()
- public int getTimestamp()
- public DateTimeZone getTimezone()
- public void __wakeup()
Hierarchy
Extends
Constants
Name | Value |
---|---|
DAY_ABBR | "\x021\x03" |
DAY_NAME | "\x022\x03" |
MONTH_ABBR | "\x023\x03" |
MONTH_NAME | "\x024\x03" |
ATOM | "Y-m-d\TH:i:sP" |
COOKIE | "l, d-M-y H:i:s T" |
ISO8601 | "Y-m-d\TH:i:sO" |
RFC822 | "D, d M y H:i:s O" |
RFC850 | "l, d-M-y H:i:s T" |
RFC1036 | "D, d M y H:i:s O" |
RFC1123 | "D, d M Y H:i:s O" |
RFC2822 | "D, d M Y H:i:s O" |
RFC3339 | "Y-m-d\TH:i:sP" |
RSS | "D, d M Y H:i:s O" |
W3C | "Y-m-d\TH:i:sP" |
Members
protected
- $gmt
—
Placeholder for a DateTimeZone object with GMT as the time zone. - $stz
—
Placeholder for a DateTimeZone object with the default server time zone as the time zone. - $tz
—
DateTimeZone
The DateTimeZone object for usage in rending dates as strings.
public
- $format
—
string
The format string to be applied when using the __toString() magic method.
Methods
public
- __construct() — Constructor.
- __get() — Magic method to access properties of the date given by class to the format method.
- __toString() — Magic method to render the date object in the format specified in the public static member JDate::$format.
- calendar() — Gets the date as a formatted string in a local calendar.
- dayToString() — Translates day of week number to a string.
- format() — Gets the date as a formatted string.
- getInstance() — Proxy for new JDate().
- getOffsetFromGMT() — Get the time offset from GMT in hours or seconds.
- monthToString() — Translates month number to a string.
- setTimezone() — Method to wrap the setTimezone() function and set the internal time zone object.
- toISO8601() — 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.
- toRFC822() — 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.
- toSql() — Gets the date as an SQL datetime string.
- toUnix() — Gets the date as UNIX time stamp.
Inherited from DateTime
public
- __set_state() — The __set_state handler
- __wakeup()
- add() — Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object
- createFromFormat() — Returns new DateTime object formatted according to the specified format
- diff()
- format()
- getLastErrors() — Returns the warnings and errors
- getOffset()
- getTimestamp()
- getTimezone()
- modify() — Alters the timestamp
- setDate() — Sets the date
- setISODate() — Sets the ISO date
- setTime() — Sets the time
- setTimestamp() — Sets the date and time based on an Unix timestamp
- setTimezone() — Sets the time zone for the DateTime object
- sub() — Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object