Issue Details (XML | Word | Printable)

Key: CORE-1522
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Adriano dos Santos Fernandes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Inconsistent DATEDIFF behaviour

Created: 17/Oct/07 09:52 AM   Updated: 07/Oct/08 05:30 AM
Component/s: Engine
Affects Version/s: 2.1 Beta 1, 2.1 Beta 2
Fix Version/s: 2.1 RC1

Time Tracking:
Not Specified

Issue Links:
Relate
 


 Description  « Hide
From a Russian newsgroup:

----------

I have discovered that different logic is used for operations with date and time parts.

For date:

DATEDIFF(MONTH, CAST('30.01.2007' AS DATE), CAST('31.01.2007' AS
DATE)) returns 0,

DATEDIFF(MONTH, CAST('31.01.2007' AS DATE), CAST('01.02.2007' AS
DATE)) returns 1.

So the result value changes at the month boundary.

For time:

DATEDIFF(HOUR, CAST('01:59:59' AS TIME), CAST('02:59:58' AS
TIME)) returns 0,

DATEDIFF(HOUR, CAST('01:59:59' AS TIME), CAST('02:59:59' AS
TIME)) returns 1.

So the integer number of hours is always returned.

Is it intentional? If so, why?

----------

Third query should return 1.

 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Philippe Makowski added a comment - 07/Oct/08 05:30 AM
Q/A test ok