Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
d43c3396
Commit
d43c3396
authored
Jan 26, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatter::timeZone should take string only.
parent
a43f8b23
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
Formatter.php
framework/base/Formatter.php
+3
-4
No files found.
framework/base/Formatter.php
View file @
d43c3396
...
@@ -28,12 +28,11 @@ use yii\helpers\Html;
...
@@ -28,12 +28,11 @@ use yii\helpers\Html;
class
Formatter
extends
Component
class
Formatter
extends
Component
{
{
/**
/**
* @var string
|\IntlTimeZone|\DateTimeZone
the timezone to use for formatting time and date values.
* @var string the timezone to use for formatting time and date values.
* This can be any value that may be passed to [date_default_timezone_set()](http://www.php.net/manual/en/function.date-default-timezone-set.php)
* This can be any value that may be passed to [date_default_timezone_set()](http://www.php.net/manual/en/function.date-default-timezone-set.php)
* e.g. `UTC`, `Europe/Berlin` or `America/Chicago`.
* e.g. `UTC`, `Europe/Berlin` or `America/Chicago`.
* Refer to the [php manual](http://www.php.net/manual/en/timezones.php) for available timezones.
* Refer to the [php manual](http://www.php.net/manual/en/timezones.php) for available timezones.
* This can also be an IntlTimeZone or a DateTimeZone object.
* If this property is not set, [[\yii\base\Application::timezone]] will be used.
* If not set, [[\yii\base\Application::timezone]] will be used.
*/
*/
public
$timeZone
;
public
$timeZone
;
/**
/**
...
@@ -344,7 +343,7 @@ class Formatter extends Component
...
@@ -344,7 +343,7 @@ class Formatter extends Component
*/
*/
protected
function
formatTimestamp
(
$value
,
$format
)
protected
function
formatTimestamp
(
$value
,
$format
)
{
{
$date
=
new
DateTime
(
null
,
is_string
(
$this
->
timeZone
)
?
new
\DateTimeZone
(
$this
->
timeZone
)
:
$this
->
timeZone
);
$date
=
new
DateTime
(
null
,
new
\DateTimeZone
(
$this
->
timeZone
)
);
$date
->
setTimestamp
(
$value
);
$date
->
setTimestamp
(
$value
);
return
$date
->
format
(
$format
);
return
$date
->
format
(
$format
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment