Professional Web Applications Themes

#39959 [NEW]: date "w" returns incorrect data - PHP Bugs

From: testingthis222 at hotmail dot com Operating system: unknown PHP version: 5.2.0 PHP Bug Type: Output Control Bug description: date "w" returns incorrect data Description: ------------ echo date("w",mktime(0,0,0,12,01,1933)); gives the wrong day it returns 3 (=wednesday) but it should be 5 (=friday) ? -- Edit bug report at [url]http://bugs.php.net/?id=39959&edit=1[/url] -- Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39959&r=trysnapshot44[/url] Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39959&r=trysnapshot52[/url] Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39959&r=trysnapshot60[/url] Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39959&r=fixedcvs[/url] Fixed in release: [url]http://bugs.php.net/fix.php?id=39959&r=alreadyfixed[/url] Need backtrace: [url]http://bugs.php.net/fix.php?id=39959&r=needtrace[/url] Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39959&r=needscript[/url] Try newer version: [url]http://bugs.php.net/fix.php?id=39959&r=oldversion[/url] Not developer issue: [url]http://bugs.php.net/fix.php?id=39959&r=support[/url] Expected behavior: [url]http://bugs.php.net/fix.php?id=39959&r=notwrong[/url] Not enough info: ...

  1. #1

    Default #39959 [NEW]: date "w" returns incorrect data

    From: testingthis222 at hotmail dot com
    Operating system: unknown
    PHP version: 5.2.0
    PHP Bug Type: Output Control
    Bug description: date "w" returns incorrect data

    Description:
    ------------
    echo date("w",mktime(0,0,0,12,01,1933));

    gives the wrong day
    it returns 3 (=wednesday)

    but it should be 5 (=friday)

    ?


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

  2. #2

    Default #39959 [Opn->Fbk]: date "w" returns incorrect data

    ID: 39959
    Updated by: [email]derickphp.net[/email]
    Reported By: testingthis222 at hotmail dot com
    -Status: Open
    +Status: Feedback
    Bug Type: Output Control
    Operating System: unknown
    PHP Version: 5.2.0
    New Comment:

    Works for me:
    derickkossu:~$ php
    <?php
    echo date("w",mktime(0,0,0,12,01,1933));

    ?>
    5

    derickkossu:~$ php -v
    PHP 5.2.1RC2-dev (cli) (built: Dec 23 2006 20:56:19) (DEBUG)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

    Which timezone is listed in phpinfo() output and what does "echo
    date_default_timezone_get();" output?


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

    [2006-12-26 23:50:40] testingthis222 at hotmail dot com

    Description:
    ------------
    echo date("w",mktime(0,0,0,12,01,1933));

    gives the wrong day
    it returns 3 (=wednesday)

    but it should be 5 (=friday)

    ?



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


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

  3. #3

    Default #39959 [Fbk->Opn]: date "w" returns incorrect data

    ID: 39959
    User updated by: testingthis222 at hotmail dot com
    Reported By: testingthis222 at hotmail dot com
    -Status: Feedback
    +Status: Open
    Bug Type: Output Control
    Operating System: unknown
    -PHP Version: 5.2.0
    +PHP Version: 4.4.4
    New Comment:

    I'm sorry I seem to have posted it in the wrong version-thread.

    My php version is 4.4.4.

    echo date("w",mktime(0,0,0,12,01,1933));

    returns 3 while it should be 5

    (shouldn't it be 5 regardless of timezone?)

    anyway; phpinfo() has no default TZ listed; and changing it to a US
    timezone doesn't change the output (still returns 3)


    echo date_default_timezone_get();

    seems to not be available in version 4.4.4.


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

    [2006-12-27 08:58:18] [email]derickphp.net[/email]

    Works for me:
    derickkossu:~$ php
    <?php
    echo date("w",mktime(0,0,0,12,01,1933));

    ?>
    5

    derickkossu:~$ php -v
    PHP 5.2.1RC2-dev (cli) (built: Dec 23 2006 20:56:19) (DEBUG)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

    Which timezone is listed in phpinfo() output and what does "echo
    date_default_timezone_get();" output?

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

    [2006-12-26 23:50:40] testingthis222 at hotmail dot com

    Description:
    ------------
    echo date("w",mktime(0,0,0,12,01,1933));

    gives the wrong day
    it returns 3 (=wednesday)

    but it should be 5 (=friday)

    ?



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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39959&edit=1[/url]
    testingthis222 at hotmail dot com Guest

  4. #4

    Default #39959 [Opn->Bgs]: date "w" returns incorrect data

    ID: 39959
    User updated by: testingthis222 at hotmail dot com
    Reported By: testingthis222 at hotmail dot com
    -Status: Open
    +Status: Bogus
    Bug Type: Output Control
    Operating System: unknown
    PHP Version: 4.4.4
    New Comment:

    should have used

    $is_day=jddayofweek(cal_to_jd(CAL_GREGORIAN,$month ,$day,$year),0)+1;

    to dates prior to 1970 in version 4.4.4.


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

    [2006-12-27 14:29:35] testingthis222 at hotmail dot com

    I'm sorry I seem to have posted it in the wrong version-thread.

    My php version is 4.4.4.

    echo date("w",mktime(0,0,0,12,01,1933));

    returns 3 while it should be 5

    (shouldn't it be 5 regardless of timezone?)

    anyway; phpinfo() has no default TZ listed; and changing it to a US
    timezone doesn't change the output (still returns 3)


    echo date_default_timezone_get();

    seems to not be available in version 4.4.4.

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

    [2006-12-27 08:58:18] [email]derickphp.net[/email]

    Works for me:
    derickkossu:~$ php
    <?php
    echo date("w",mktime(0,0,0,12,01,1933));

    ?>
    5

    derickkossu:~$ php -v
    PHP 5.2.1RC2-dev (cli) (built: Dec 23 2006 20:56:19) (DEBUG)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

    Which timezone is listed in phpinfo() output and what does "echo
    date_default_timezone_get();" output?

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

    [2006-12-26 23:50:40] testingthis222 at hotmail dot com

    Description:
    ------------
    echo date("w",mktime(0,0,0,12,01,1933));

    gives the wrong day
    it returns 3 (=wednesday)

    but it should be 5 (=friday)

    ?



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


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

    testingthis222 at hotmail dot com Guest

Similar Threads

  1. Replies: 1
    Last Post: February 25th, 03:59 PM
  2. #20382 [Com]: strtotime ("Monday", $date) can produce incorrect output
    By pierre dot baudracco at aliacom dot fr in forum PHP Development
    Replies: 3
    Last Post: December 15th, 05:33 PM
  3. Replies: 0
    Last Post: August 5th, 01:25 AM
  4. Replies: 0
    Last Post: August 5th, 12:30 AM
  5. Replies: 0
    Last Post: August 4th, 10:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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