php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29744 DARTPART function returns random results
Submitted: 2004-08-18 22:14 UTC Modified: 2005-03-20 18:04 UTC
From: jwhatcher at hotmail dot com Assigned:
Status: No Feedback Package: MSSQL related
PHP Version: 5.0.0 OS: WINDOWS 2000 Advance Server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
22 - 3 = ?
Subscribe to this entry?

 
 [2004-08-18 22:14 UTC] jwhatcher at hotmail dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-07 20:25 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-03-20 18:04 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 08 01:03:53 2023 UTC