DATEDIFF behavior bug
---------------------

                 Key: CORE-3793
                 URL: http://tracker.firebirdsql.org/browse/CORE-3793
             Project: Firebird Core
          Issue Type: Bug
    Affects Versions: 2.5.1
         Environment: Windows 2008 Server R2
            Reporter: Montri Patchaiyo


SELECT
   DATEDIFF(
     YEAR
     FROM CAST('Dec 31, 2011' AS DATE)
     TO CAST('Jan 01, 2012' AS DATE)) AS DIFF_YEAR,
   DATEDIFF(
     MONTH
     FROM CAST('Dec 31, 2011' AS DATE)
     TO CAST('Jan 01, 2012' AS DATE)) AS DIFF_MONTH,
   DATEDIFF(
     DAY
     FROM CAST('Dec 31, 2011' AS DATE)
     TO CAST('Jan 01, 2012' AS DATE)) AS DIFF_DAY

FROM
  RDB$DATABASE

Result for above query is Year: 1, Month: 1, Day: 1.
Is it correct? why result of DATEDIFF function was rounded up?

IMO, Correct result is Year: 0, Month: 0, Day: 1

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to