\DateTime
Synopsis
class DateTime
implements
DateTimeInterface
{
- // constants
- 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 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
Constants
Name | Value |
---|---|
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" |
Methods
public
- __construct() — Returns new DateTime object
- __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