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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
b1a26ff3
Commit
b1a26ff3
authored
Apr 20, 2014
by
Kartik Visweswaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the Y2K38 bug
Adds support for timestamps beyond year 2038.
parent
ad7f57de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
Formatter.php
framework/base/Formatter.php
+10
-4
No files found.
framework/base/Formatter.php
View file @
b1a26ff3
...
...
@@ -342,18 +342,24 @@ class Formatter extends Component
/**
* Normalizes the given datetime value as one that can be taken by various date/time formatting methods.
*
* @param mixed $value the datetime value to be normalized.
* @return integer the normalized datetime value
*/
protected
function
normalizeDatetimeValue
(
$value
)
{
if
(
is_string
(
$value
))
{
return
is_numeric
(
$value
)
||
$value
===
''
?
(
int
)
$value
:
strtotime
(
$value
);
if
(
is_numeric
(
$value
)
||
$value
===
''
)
{
$value
=
(
double
)
$value
;
}
else
{
$date
=
new
DateTime
(
$value
);
$value
=
$date
->
format
(
'U'
);
}
return
$value
;
}
elseif
(
$value
instanceof
DateTime
||
$value
instanceof
\DateTimeInterface
)
{
/** @var $value \DateTimeInterface */
return
$value
->
getTimestamp
();
return
$value
->
format
(
'U'
);
}
else
{
return
(
int
)
$value
;
return
(
double
)
$value
;
}
}
...
...
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