|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-07 20:25 UTC] sniper@php.net
[2005-03-20 18:04 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 08:00:01 2025 UTC |
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.