Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • ActiveRecord
  • Cache
  • Configs
  • Core
  • DateTime
  • Debug
  • DeleteOperation
  • Errors
  • Event
  • EventHook
  • Events
  • FileCache
  • FormattedString
  • Helpers
  • I18n
  • Image
  • Inflections
  • Inflector
  • Models
  • Module
  • Modules
  • Object
  • Operation
  • PingOperation
  • Prototype
  • Route
  • Routes
  • SaveOperation
  • Session
  • TimeZone
  • TimeZoneLocation
  • Uploaded
  • Vars
  • VarsIterator

Interfaces

  • StorageInterface
  • ToArray
  • ToArrayRecursive

Traits

  • PrototypeTrait
  • ToArrayRecursiveTrait

Exceptions

  • AlreadyAuthenticated
  • AuthenticationRequired
  • Exception
  • ModuleConstructorMissing
  • ModuleIsDisabled
  • ModuleNotDefined
  • OffsetError
  • OffsetNotDefined
  • OffsetNotReadable
  • OffsetNotWritable
  • PermissionRequired
  • PropertyError
  • PropertyIsReserved
  • PropertyNotDefined
  • PropertyNotReadable
  • PropertyNotWritable
  • RouteNotDefined
  • SecurityException

Constants

  • TOKEN_ALPHA
  • TOKEN_ALPHA_UPCASE
  • TOKEN_NUMERIC
  • TOKEN_SYMBOL
  • TOKEN_SYMBOL_WIDE

Functions

  • array_flatten
  • array_insert
  • array_merge_recursive
  • camelize
  • capitalize
  • downcase
  • dump
  • escape
  • escape_all
  • exact_array_merge_recursive
  • excerpt
  • format
  • generate_token
  • generate_token_wide
  • generate_v4_uuid
  • get_autoconfig
  • humanize
  • hyphenate
  • log
  • log_error
  • log_info
  • log_success
  • log_time
  • normalize
  • normalize_namespace_part
  • normalize_url_path
  • pbkdf2
  • pluralize
  • remove_accents
  • shorten
  • singularize
  • sort_by_weight
  • stable_sort
  • strip_root
  • titleize
  • unaccent_compare
  • unaccent_compare_ci
  • underscore
  • upcase

Class DateTime

Representation of a date and time.

<?php

// Let's say that _now_ is 2013-02-03 21:03:45 in Paris

use ICanBoogie\DateTime;

date_default_timezone_set('EST'); // set local time zone to Eastern Standard Time

$time = new DateTime('now', 'Europe/Paris');

echo $time;                             // 2013-02-03T21:03:45+0100
echo $time->utc;                        // 2013-02-03T20:03:45Z
echo $time->local;                      // 2013-02-03T15:03:45-0500
echo $time->utc->local;                 // 2013-02-03T15:03:45-0500
echo $time->utc->is_utc;                // true
echo $time->utc->is_local;              // false
echo $time->local->is_utc;              // false
echo $time->local->is_local;            // true
echo $time->is_dst;                     // false

echo $time->as_rss;                     // Sun, 03 Feb 2013 21:03:45 +0100
echo $time->as_db;                      // 2013-02-03 21:03:45

echo $time->as_time;                    // 21:03:45
echo $time->utc->as_time;               // 20:03:45
echo $time->local->as_time;             // 15:03:45
echo $time->utc->local->as_time;        // 15:03:45

echo $time->quarter;                    // 1
echo $time->week;                       // 5
echo $time->day;                        // 3
echo $time->minute;                     // 3
echo $time->is_monday;                  // false
echo $time->is_saturday;                // true
echo $time->is_today;                   // true
echo $time->tomorrow;                   // 2013-02-04T00:00:00+0100
echo $time->tomorrow->is_future         // true
echo $time->yesterday;                  // 2013-02-02T00:00:00+0100
echo $time->yesterday->is_past          // true
echo $time->monday;                     // 2013-01-28T00:00:00+0100
echo $time->sunday;                     // 2013-02-03T00:00:00+0100

echo $time->timestamp;                  // 1359921825
echo $time;                             // 2013-02-03T21:03:45+0100
$time->timestamp += 3600 * 4;
echo $time;                             // 2013-02-04T01:03:45+0100

echo $time->zone;                       // Europe/Paris
echo $time->zone->offset;               // 3600
echo $time->zone->location;             // FR,48.86667,2.33333
echo $time->zone->location->latitude;   // 48.86667
$time->zone = 'Asia/Tokyo';
echo $time;                             // 2013-02-04T09:03:45+0900

$time->hour += 72;
echo "Rendez-vous in 72 hours: $time";  // Rendez-vous in 72 hours: 2013-02-07T05:03:45+0900

Empty dates are also supported:

<?php

$time = new DateTime('0000-00-00', 'utc');
// or
$time = DateTime::none();
echo $time;                             // -0001-11-30T00:00:00Z
echo $time->is_empty;                   // true
echo $time->as_date;                    // 0000-00-00
echo $time->as_db;                      // 0000-00-00 00:00:00

DateTime
Extended by ICanBoogie\DateTime

Direct known subclasses

ICanBoogie\HTTP\DateHeader

Namespace: ICanBoogie
See: http://en.wikipedia.org/wiki/ISO_8601
Located at vendor/icanboogie/datetime/lib/datetime.php

Methods summary

public static ICanBoogie\DateTime
# from( mixed $source, mixed $timezone = null )

Creates a ICanBoogie\DateTime instance from a source.

Creates a ICanBoogie\DateTime instance from a source.

<?php

use ICanBoogie\DateTime;

DateTime::from(new \DateTime('2001-01-01 01:01:01', new \DateTimeZone('Europe/Paris')));
DateTime::from('2001-01-01 01:01:01', 'Europe/Paris');
DateTime::from('now');

Parameters

$source
mixed
$source
$timezone
mixed
$timezone The time zone to use to create the time. The value is ignored if the source is an instance of DateTime.

Returns

ICanBoogie\DateTime
public static ICanBoogie\DateTime
# now( )

Returns an instance with the current local time and the local time zone.

Returns an instance with the current local time and the local time zone.

Returns

ICanBoogie\DateTime
public static ICanBoogie\DateTime
# none( DateTimeZone|string $timezone = 'utc' )

Returns an instance representing an empty date ("0000-00-00").

Returns an instance representing an empty date ("0000-00-00").

<?php

use ICanBoogie\DateTime;

$d = DateTime::none();
$d->is_empty;                      // true
$d->zone->name;                    // "UTC"

$d = DateTime::none('Asia/Tokyo');
$d->is_empty;                      // true
$d->zone->name;                    // "Asia/Tokio"

Parameters

$timezone
DateTimeZone|string
$timezone The time zone in which the empty date is created. Defaults to "UTC".

Returns

ICanBoogie\DateTime
public
# __construct( string $time = 'now', DateTimeZone|string|null $timezone = null )

If the time zone is specified as a string a DateTimeZone instance is created and used instead.

If the time zone is specified as a string a DateTimeZone instance is created and used instead.

<?php

use ICanBoogie\DateTime;

new DateTime('2001-01-01 01:01:01', new \DateTimeZone('Europe/Paris')));
new DateTime('2001-01-01 01:01:01', 'Europe/Paris');
new DateTime;

Parameters

$time
string
$time Defaults to "now".
$timezone
DateTimeZone|string|null
$timezone

Overrides

DateTime::__construct
public
# __get( mixed $property )
protected ICanBoogie\DateTime
# get_monday( )

Returns Monday of the week.

Returns Monday of the week.

Returns

ICanBoogie\DateTime
protected ICanBoogie\DateTime
# get_tuesday( )

Returns Tuesday of the week.

Returns Tuesday of the week.

Returns

ICanBoogie\DateTime
protected ICanBoogie\DateTime
# get_wednesday( )

Returns Wednesday of the week.

Returns Wednesday of the week.

Returns

ICanBoogie\DateTime
protected ICanBoogie\DateTime
# get_thursday( )

Returns Thursday of the week.

Returns Thursday of the week.

Returns

ICanBoogie\DateTime
protected ICanBoogie\DateTime
# get_friday( )

Returns Friday of the week.

Returns Friday of the week.

Returns

ICanBoogie\DateTime
protected ICanBoogie\DateTime
# get_saturday( )

Returns Saturday of the week.

Returns Saturday of the week.

Returns

ICanBoogie\DateTime
protected ICanBoogie\DateTime
# get_sunday( )

Returns Sunday of the week.

Returns Sunday of the week.

Returns

ICanBoogie\DateTime
public
# __set( mixed $property, mixed $value )

Sets the $year, $month, $day, $hour, $minute, $second, $timestamp and $zone properties.

Sets the $year, $month, $day, $hour, $minute, $second, $timestamp and $zone properties.

Throws

ICanBoogie\PropertyNotWritable
in attempt to set a read-only property.
ICanBoogie\PropertyNotDefined
in attempt to set an unsupported property.
public
# __call( mixed $method, mixed $arguments )

Handles the format_as_* methods.

Handles the format_as_* methods.

If the format is DateTime::RFC822 or DateTime::RFC1123 and the time zone is equivalent to GMT, the offset +0000 is replaced by GMT according to the specs.

If the format is DateTime::ISO8601 and the time zone is equivalent to UTC, the offset +0000 is replaced by Z according to the specs.

Throws

BadMethodCallException
in attempt to call an unsupported method.
public
# __toString( )

Returns the datetime formated as DateTime::ISO8601.

Returns the datetime formated as DateTime::ISO8601.

public
# setTimezone( mixed $timezone )

The timezone can be specified as a string.

The timezone can be specified as a string.

If the timezone is local the timezone returned by date_default_timezone_get() is used instead.

Overrides

DateTime::setTimezone
public
# change( array $options, boolean $cascade = false )

Modifies the properties of the instance occording to the options.

Modifies the properties of the instance occording to the options.

The following properties can be updated: $year, $month, $day, $hour, $minute and $second.

Note: Values exceeding ranges are added to their parent values.

<?php

use ICanBoogie\DateTime;

$time = new DateTime('now');
$time->change(array('year' => 2000, 'second' => 0));

Parameters

$options
array
$options
$cascade
boolean
$cascade If true, time options (hour, minute, second) reset cascadingly, so if only the hour is passed, then minute and second is set to 0. If the hour and minute is passed, then second is set to 0.
public
# format( mixed $format )

If the instance represents an empty date and the format is ICanBoogie\DateTime::DATE or ICanBoogie\DateTime::DB, an empty date is returned, respectively "0000-00-00" and "0000-00-00 00:00:00". Note that the time information is discarted for ICanBoogie\DateTime::DB. This only apply to ICanBoogie\DateTime::DATE and ICanBoogie\DateTime::DB formats. For instance DateTime::RSS will return the following string: "Wed, 30 Nov -0001 00:00:00 +0000".

If the instance represents an empty date and the format is ICanBoogie\DateTime::DATE or ICanBoogie\DateTime::DB, an empty date is returned, respectively "0000-00-00" and "0000-00-00 00:00:00". Note that the time information is discarted for ICanBoogie\DateTime::DB. This only apply to ICanBoogie\DateTime::DATE and ICanBoogie\DateTime::DB formats. For instance DateTime::RSS will return the following string: "Wed, 30 Nov -0001 00:00:00 +0000".

Overrides

DateTime::format

Methods inherited from DateTime

__set_state(), __wakeup(), add(), createFromFormat(), diff(), getLastErrors(), getOffset(), getTimestamp(), getTimezone(), modify(), setDate(), setISODate(), setTime(), setTimestamp(), sub()

Magic methods summary

public string
# format_as_atom( )

Formats the instance according to DateTime::ATOM.

Formats the instance according to DateTime::ATOM.

Returns

string
public string
# format_as_cookie( )

Formats the instance according to DateTime::COOKIE.

Formats the instance according to DateTime::COOKIE.

Returns

string
public string
# format_as_iso8601( )

Formats the instance according to DateTime::ISO8601.

Formats the instance according to DateTime::ISO8601.

Returns

string
public string
# format_as_rfc822( )

Formats the instance according to DateTime::RFC822.

Formats the instance according to DateTime::RFC822.

Returns

string
public string
# format_as_rfc850( )

Formats the instance according to DateTime::RFC850.

Formats the instance according to DateTime::RFC850.

Returns

string
public string
# format_as_rfc1036( )

Formats the instance according to DateTime::RFC1036.

Formats the instance according to DateTime::RFC1036.

Returns

string
public string
# format_as_rfc1123( )

Formats the instance according to DateTime::RFC1123.

Formats the instance according to DateTime::RFC1123.

Returns

string
public string
# format_as_rfc2822( )

Formats the instance according to DateTime::RFC2822.

Formats the instance according to DateTime::RFC2822.

Returns

string
public string
# format_as_rfc3339( )

Formats the instance according to DateTime::RFC3339.

Formats the instance according to DateTime::RFC3339.

Returns

string
public string
# format_as_rss( )

Formats the instance according to DateTime::RSS.

Formats the instance according to DateTime::RSS.

Returns

string
public string
# format_as_w3c( )

Formats the instance according to DateTime::W3C.

Formats the instance according to DateTime::W3C.

Returns

string
public string
# format_as_db( )

Formats the instance according to ICanBoogie\DateTime::DB.

Formats the instance according to ICanBoogie\DateTime::DB.

Returns

string
public string
# format_as_number( )

Formats the instance according to ICanBoogie\DateTime::NUMBER.

Formats the instance according to ICanBoogie\DateTime::NUMBER.

Returns

string
public string
# format_as_date( )

Formats the instance according to ICanBoogie\DateTime::DATE.

Formats the instance according to ICanBoogie\DateTime::DATE.

Returns

string
public string
# format_as_time( )

Formats the instance according to ICanBoogie\DateTime::TIME.

Formats the instance according to ICanBoogie\DateTime::TIME.

Returns

string

Constants summary

string DB 'Y-m-d H:i:s'
#

DB (example: 2013-02-03 20:59:03)

DB (example: 2013-02-03 20:59:03)

string NUMBER 'YmdHis'
#

Number (example: 20130203205903)

Number (example: 20130203205903)

string DATE 'Y-m-d'
#

Date (example: 2013-02-03)

Date (example: 2013-02-03)

string TIME 'H:i:s'
#

Time (example: 20:59:03)

Time (example: 20:59:03)

Constants inherited from DateTime

ATOM, COOKIE, ISO8601, RFC1036, RFC1123, RFC2822, RFC3339, RFC822, RFC850, RSS, W3C

Properties summary

Magic properties

public integer $timestamp
#

Unix timestamp.

Unix timestamp.

public integer $day
#

Day of the month.

Day of the month.

public integer $hour
#

Hour of the day.

Hour of the day.

public integer $minute
#

Minute of the hour.

Minute of the hour.

public integer $month
#

Month of the year.

Month of the year.

public integer $second
#

Second of the minute.

Second of the minute.

public integer $year
#

Year.

Year.

public ICanBoogie\TimeZone $zone
#

The timezone of the instance.

The timezone of the instance.

public read-only integer $quarter
#

Quarter of the year.

Quarter of the year.

public read-only integer $week
#

Week of the year.

Week of the year.

public read-only integer $weekday
#

Day of the week.

Day of the week.

public read-only integer $year_day
#

Day of the year.

Day of the year.

public read-only boolean $is_monday
#

true if the instance represents Monday.

true if the instance represents Monday.

public read-only boolean $is_tuesday
#

true if the instance represents Tuesday.

true if the instance represents Tuesday.

public read-only boolean $is_wednesday
#

true if the instance represents Wednesday.

true if the instance represents Wednesday.

public read-only boolean $is_thursday
#

true if the instance represents Thursday.

true if the instance represents Thursday.

public read-only boolean $is_friday
#

true if the instance represents Friday.

true if the instance represents Friday.

public read-only boolean $is_saturday
#

true if the instance represents Satruday.

true if the instance represents Satruday.

public read-only boolean $is_sunday
#

true if the instance represents Sunday.

true if the instance represents Sunday.

public read-only boolean $is_today
#

true if the instance is today.

true if the instance is today.

public read-only boolean $is_past
#

true if the instance lies in the past.

true if the instance lies in the past.

public read-only boolean $is_future
#

true if the instance lies in the future.

true if the instance lies in the future.

public read-only boolean $is_empty
#

true if the instance represents an empty date such as "0000-00-00" or "0000-00-00 00:00:00".

true if the instance represents an empty date such as "0000-00-00" or "0000-00-00 00:00:00".

public read-only ICanBoogie\DateTime $tomorrow
#

A new instance representing the next day. Time is reseted to 00:00:00.

A new instance representing the next day. Time is reseted to 00:00:00.

public read-only ICanBoogie\DateTime $yesterday
#

A new instance representing the previous day. Time is reseted to 00:00:00.

A new instance representing the previous day. Time is reseted to 00:00:00.

public read-only ICanBoogie\DateTime $monday
#

A new instance representing Monday of the week. Time is reseted to 00:00:00.

A new instance representing Monday of the week. Time is reseted to 00:00:00.

public read-only ICanBoogie\DateTime $tuesday
#

A new instance representing Tuesday of the week. Time is reseted to 00:00:00.

A new instance representing Tuesday of the week. Time is reseted to 00:00:00.

public read-only ICanBoogie\DateTime $wednesday
#

A new instance representing Wednesday of the week. Time is reseted to 00:00:00.

A new instance representing Wednesday of the week. Time is reseted to 00:00:00.

public read-only ICanBoogie\DateTime $thursday
#

A new instance representing Thursday of the week. Time is reseted to 00:00:00.

A new instance representing Thursday of the week. Time is reseted to 00:00:00.

public read-only ICanBoogie\DateTime $friday
#

A new instance representing Friday of the week. Time is reseted to 00:00:00.

A new instance representing Friday of the week. Time is reseted to 00:00:00.

public read-only ICanBoogie\DateTime $saturday
#

A new instance representing Saturday of the week. Time is reseted to 00:00:00.

A new instance representing Saturday of the week. Time is reseted to 00:00:00.

public read-only ICanBoogie\DateTime $sunday
#

A new instance representing Sunday of the week. Time is reseted to 00:00:00.

A new instance representing Sunday of the week. Time is reseted to 00:00:00.

public read-only string $as_atom
#

The instance formatted according to DateTime::ATOM.

The instance formatted according to DateTime::ATOM.

public read-only string $as_cookie
#

The instance formatted according to DateTime::COOKIE.

The instance formatted according to DateTime::COOKIE.

public read-only string $as_iso8601
#

The instance formatted according to DateTime::ISO8601.

The instance formatted according to DateTime::ISO8601.

public read-only string $as_rfc822
#

The instance formatted according to DateTime::RFC822.

The instance formatted according to DateTime::RFC822.

public read-only string $as_rfc850
#

The instance formatted according to DateTime::RFC850.

The instance formatted according to DateTime::RFC850.

public read-only string $as_rfc1036
#

The instance formatted according to DateTime::RFC1036.

The instance formatted according to DateTime::RFC1036.

public read-only string $as_rfc1123
#

The instance formatted according to DateTime::RFC1123.

The instance formatted according to DateTime::RFC1123.

public read-only string $as_rfc2822
#

The instance formatted according to DateTime::RFC2822.

The instance formatted according to DateTime::RFC2822.

public read-only string $as_rfc3339
#

The instance formatted according to DateTime::RFC3339.

The instance formatted according to DateTime::RFC3339.

public read-only string $as_rss
#

The instance formatted according to DateTime::RSS.

The instance formatted according to DateTime::RSS.

public read-only string $as_w3c
#

The instance formatted according to DateTime::W3C.

The instance formatted according to DateTime::W3C.

public read-only string $as_db
#

The instance formatted according to ICanBoogie\DateTime::DB.

The instance formatted according to ICanBoogie\DateTime::DB.

public read-only string $as_number
#

The instance formatted according to ICanBoogie\DateTime::NUMBER.

The instance formatted according to ICanBoogie\DateTime::NUMBER.

public read-only string $as_date
#

The instance formatted according to ICanBoogie\DateTime::DATE.

The instance formatted according to ICanBoogie\DateTime::DATE.

public read-only string $as_time
#

The instance formatted according to ICanBoogie\DateTime::TIME.

The instance formatted according to ICanBoogie\DateTime::TIME.

public read-only ICanBoogie\DateTime $utc
#

A new instance in the UTC timezone.

A new instance in the UTC timezone.

public read-only ICanBoogie\DateTime $local
#

A new instance in the local timezone.

A new instance in the local timezone.

public read-only boolean $is_utc
#

true if the instance is in the UTC timezone.

true if the instance is in the UTC timezone.

public read-only boolean $is_local
#

true if the instance is in the local timezone.

true if the instance is in the local timezone.

public read-only boolean $is_dst
#

true if time occurs during Daylight Saving Time in its time zone.

true if time occurs during Daylight Saving Time in its time zone.

Autodoc API documentation generated by ApiGen 2.8.0