Filter/DateUtcToLocal.php

Show: inherited
Table of Contents

conjoon (c) 2002-2012 siteartwork.de/conjoon.org licensing@conjoon.org

$Id: DateUtcToLocal.php 1450 2012-10-28 07:59:17Z T. Suckow $

Author
Thorsten Suckow-Homberg  
Copyright
2012 The conjoon Open Source Project  
Package
Conjoon\Filter\Date  

\Conjoon_Filter_DateUtcToLocal

Package: Conjoon\Filter

Converts a UTC data to a local date.

Note: This class will not check whether the date passed to "filter" is actually a UTC date.

Parent(s)
?\Zend_Filter_Interface
Author
Thorsten Suckow-Homberg  
Category
Filter  

Constants

Constant  OPTIONS_TIMEZONE = 'timezone'

Type
string  

Properties

Propertyprotected  $_timezone= ''

Stores thetimezone the UTC dates passed to filter() will be converted to.

Details
Type
n/a
Type
string  

Methods

methodpublic__construct( Array | \Zend_Config | null $options = null ) : void

Constructs a new instance of Conjoon_Filter_DateUtcToLocal

Parameters
Name Type Description
$options Array | \Zend_Config | null

The argument holds configuration options for this instance. If the argument is null, the current timezone as found in date_default_timezone_get() will be used. Otherwise, the key self::OPTIONS_TIMEZONE will be looked up and used for converting the UTC date.

Throws
Exception Description
\Conjoon\Filter\Exception If $options 'timezone' value is not valid, if the option-key for the timezone is missing or if $options is an invalid type
Details
See
\Conjoon\Filter\DateUtcToLocal::setTimezone()  
methodpublicfilter( mixed $value ) : string

Converts the passed string to a date in the timezone of self::$_timezone.

Returns a UTC date converted to the local date as determined by the timezonefound in self::$_timezone, which can be specified when instantiating this class. The date sttring returned will be in the format of YYYY-MM-dd HH:mm:ss. Note: The passed argument must already be a UTC date! This method will not check whether the passed argument's timezone is UTC This method will gracefully fall back to teh default date of 1970-01-01 00:00:00 if it could not convert the passed argument properly.

Parameters
Name Type Description
$value mixed
Returns
Type Description
string
methodpublicgetTimezone( ) : string

Returns the timezone currently used with this instance.

Returns
Type Description
string
methodpublicsetTimezone( string $timezone ) : bool

Sets the timezone this filter will use to convert UTC dates to.

Parameters
Name Type Description
$timezone string

The timezone to use for converting UTC dates to.

Returns
Type Description
bool true if the timezone of this instance was successfully set to the value of the passed argument
Throws
Exception Description
\Conjoon_Filter_Exception if the passed argument is not a valid timezone
Documentation was generated by DocBlox 0.18.1.