From:             jwhatcher at hotmail dot com
Operating system: WINDOWS 2000 Advance Server
PHP version:      5.0.0
PHP Bug Type:     MSSQL related
Bug description:  DARTPART function returns random results

Description:
------------
Using in my where clause, DATEPART (dw , dt.usedate) = 1 returns random
results toggling between SUNDAY AND MONDAY. Switch to DATENAME (dw ,
dt.usedate) = 'Sunday' and it works fine. This code worked fine in 4.2. 

date_table is a table with all dates between 1900 to 2050.

Reproduce code:
---------------
$query = mssql_query("  SELECT  dt.usedate                                      FROM   
 date_table
dt                                      WHERE   dt.usedate between '$s_reportdate' AND 
'$e_reportdate'
AND     DATEPART (dw , dt.usedate) = 1
ORDER BY DT.usedate");

Expected result:
----------------
Should return Sunday dates between range provided.

Actual result:
--------------
Returns seemingly random results of either a Monday or Sunday date. If I
add DATEPART (dw , dt.usedate) as blah into the select clause it returns 1
every time but the dates still shift.

-- 
Edit bug report at http://bugs.php.net/?id=29744&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29744&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29744&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29744&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29744&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29744&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29744&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29744&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29744&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29744&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29744&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29744&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29744&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29744&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29744&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29744&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29744&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29744&r=float

Reply via email to