#40645 [NEW]: strtotime don't work with negative timestamps

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40645 [NEW]: strtotime don't work with negative timestamps

    From: simone at ivg dot it
    Operating system: Linux 2.6
    PHP version: 4.4.5
    PHP Bug Type: Date/time related
    Bug description: strtotime don't work with negative timestamps

    Description:
    ------------
    The strtotime() function returns -1 if the date is prior to 1970-01-01.
    Instead, date function works properly with negative timestamps.


    Reproduce code:
    ---------------
    strtotime("1951-12-22") returns -1
    date("d/m/Y",-578944001) returns 28/08/1951



    --
    Edit bug report at [url]http://bugs.php.net/?id=40645&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40645&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40645&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40645&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40645&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40645&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40645&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40645&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40645&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40645&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40645&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40645&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40645&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40645&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40645&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40645&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40645&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40645&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40645&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40645&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40645&r=mysqlcfg[/url]
    simone at ivg dot it Guest

  2. Similar Questions and Discussions

    1. Error Selecting Timestamps - String Index out of Range
      We are running CFMX 6.1 on Linux Connecting to a PostgreSQL 7.X database cluster. When we try to perform a query that selects a timestamp from...
    2. Acrobat 6.0.2 won't save Advanced Print setups and Negative Doesn't work
      I am having lots of problems getting Acrobat 6.0.x to work. Mac OS 10.3.t. I tried all versions and updated to the current version. When I go to...
    3. Number of milliseconds between two timestamps
      Hi all, I am trying to determine the difference between two timestamps in milliseconds. Is there any easy or difficult method of getting this...
    4. Problem with putting timestamps in date fields after Fix 10 (DB2 7.2)
      Hello out there, why does DB2 7.2 Fix 10 not more allow to put timestamps in date fields. In prior versions the time information was ignored....
    5. #15123 [Dup->Csd]: strtotime doesn't work with long date format
      ID: 15123 Updated by: sniper@php.net Reported By: htheking at gmx dot de -Status: Duplicate +Status: ...
  3. #2

    Default #40645 [Opn->Fbk]: strtotime don't work with negative timestamps

    ID: 40645
    Updated by: [email]derick@php.net[/email]
    Reported By: simone at ivg dot it
    -Status: Open
    +Status: Feedback
    Bug Type: Date/time related
    Operating System: Linux 2.6
    PHP Version: 4.4.5
    New Comment:

    This works fine for me with PHP 4.4.6RC2-dev:

    <?php
    echo strtotime("1951-12-22"), "\n";
    ?>

    -568947600



    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-26 17:55:41] simone at ivg dot it

    Description:
    ------------
    The strtotime() function returns -1 if the date is prior to
    1970-01-01.
    Instead, date function works properly with negative timestamps.


    Reproduce code:
    ---------------
    strtotime("1951-12-22") returns -1
    date("d/m/Y",-578944001) returns 28/08/1951




    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40645&edit=1[/url]
    derick@php.net Guest

  4. #3

    Default #40645 [Fbk->Csd]: strtotime don't work with negative timestamps

    ID: 40645
    User updated by: simone at ivg dot it
    Reported By: simone at ivg dot it
    -Status: Feedback
    +Status: Closed
    Bug Type: Date/time related
    Operating System: Linux 2.6
    PHP Version: 4.4.5
    New Comment:

    This isn't a PHP bug, but a GNU libc issue.
    Here I've found a C code to test if my libc has the problem:
    [url]http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=196177[/url]

    Thanks.


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-26 18:01:02] [email]derick@php.net[/email]

    This works fine for me with PHP 4.4.6RC2-dev:

    <?php
    echo strtotime("1951-12-22"), "\n";
    ?>

    -568947600


    ------------------------------------------------------------------------

    [2007-02-26 17:55:41] simone at ivg dot it

    Description:
    ------------
    The strtotime() function returns -1 if the date is prior to
    1970-01-01.
    Instead, date function works properly with negative timestamps.


    Reproduce code:
    ---------------
    strtotime("1951-12-22") returns -1
    date("d/m/Y",-578944001) returns 28/08/1951




    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40645&edit=1[/url]
    simone at ivg dot it Guest

  5. #4

    Default #40645 [Csd->Bgs]: strtotime don't work with negative timestamps

    ID: 40645
    Updated by: [email]tony2001@php.net[/email]
    Reported By: simone at ivg dot it
    -Status: Closed
    +Status: Bogus
    Bug Type: Date/time related
    Operating System: Linux 2.6
    PHP Version: 4.4.5


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-27 14:27:30] simone at ivg dot it

    This isn't a PHP bug, but a GNU libc issue.
    Here I've found a C code to test if my libc has the problem:
    [url]http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=196177[/url]

    Thanks.

    ------------------------------------------------------------------------

    [2007-02-26 18:01:02] [email]derick@php.net[/email]

    This works fine for me with PHP 4.4.6RC2-dev:

    <?php
    echo strtotime("1951-12-22"), "\n";
    ?>

    -568947600


    ------------------------------------------------------------------------

    [2007-02-26 17:55:41] simone at ivg dot it

    Description:
    ------------
    The strtotime() function returns -1 if the date is prior to
    1970-01-01.
    Instead, date function works properly with negative timestamps.


    Reproduce code:
    ---------------
    strtotime("1951-12-22") returns -1
    date("d/m/Y",-578944001) returns 28/08/1951




    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40645&edit=1[/url]
    tony2001@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139