Filter/DateUtcToLocal.php
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
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
Properties
Methods

__construct(
Array | \Zend_Config | null $options
=
null
)
:
voidConstructs a new instance of Conjoon_Filter_DateUtcToLocal
| 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. |
| 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 |
- See
- \Conjoon\Filter\DateUtcToLocal::setTimezone()

filter(
mixed $value
)
:
stringConverts 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.
| Name | Type | Description |
|---|---|---|
| $value | mixed |
| Type | Description |
|---|---|
| string |

getTimezone(
)
:
stringReturns the timezone currently used with this instance.
| Type | Description |
|---|---|
| string |

setTimezone(
string $timezone
)
:
boolSets the timezone this filter will use to convert UTC dates to.
| Name | Type | Description |
|---|---|---|
| $timezone | string | The timezone to use for converting UTC dates to. |
| Type | Description |
|---|---|
| bool | true if the timezone of this instance was successfully set to the value of the passed argument |
| Exception | Description |
|---|---|
| \Conjoon_Filter_Exception | if the passed argument is not a valid timezone |