php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68988 strtotime returns beyond the expected
Submitted: 2015-02-05 09:42 UTC Modified: 2015-02-05 10:22 UTC
From: wanting_e at 163 dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.5.21 OS: ubuntu 13.04
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wanting_e at 163 dot com
New email:
PHP Version: OS:

 

 [2015-02-05 09:42 UTC] wanting_e at 163 dot com
Description:
------------
I passed two different timestamp to strtotime() function.
I expected both of them will returns false, but the second one returns a big int! 

Test script:
---------------
<?php
date_default_timezone_set("Asia/Shanghai");

echo date('Y-m-d H:i:s', 1423122337) . '<br/>'; //2015-02-05 15:45:37
echo date('Y-m-d H:i:s', 1738598400) . '<br/>'; //2025-02-04 00:00:00

var_dump(strtotime('1423122337')); //bool(false)
var_dump(strtotime('1738598400')); //int(202914236339) 

Expected result:
----------------
2015-02-05 15:45:37
2025-02-04 00:00:00
bool(false) 
bool(false)

Actual result:
--------------
2015-02-05 15:45:37
2025-02-04 00:00:00
bool(false) 
int(202914236339) 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-05 10:22 UTC] derick@php.net
-Status: Open +Status: Not a bug
 [2015-02-05 10:22 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The parser tries to figure out what you're trying to do. That fails in the first instance:

php -r 'print_r(date_parse("1423122337"));'
Array
(
    [year] => 1423
    [month] => 12
    [day] => 23
    [hour] => 
    [minute] => 
    [second] => 
    [fraction] => 
    [warning_count] => 0
    [warnings] => Array
        (
        )

    [error_count] => 2
    [errors] => Array
        (
            [8] => Unexpected character
            [9] => Unexpected character
        )

    [is_localtime] => 
)

But succeeds in the second:

php -r 'print_r(date_parse("1738598400"));'
Array
(
    [year] => 8400
    [month] => 
    [day] => 
    [hour] => 17
    [minute] => 38
    [second] => 59
    [fraction] => 0
    [warning_count] => 0
    [warnings] => Array
        (
        )

    [error_count] => 0
    [errors] => Array
        (
        )

    [is_localtime] => 
)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 12:00:02 2026 UTC