Skip to content

Commit

Permalink
Fix for datediff.sow.week tests II-12235 (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
hab6 authored Oct 10, 2023
1 parent eebfcb8 commit 1220b1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions actian_jdbc/dialect.tdd
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,10 @@
<formula part='dayofyear'>TIMESTAMPDIFF(DAY,CAST(%2 AS TIMESTAMP(2)), %3)</formula>
<formula part='day'>TIMESTAMPDIFF(DAY,CAST(%2 AS ANSIDATE), %3)</formula>
<formula part='weekday'>TIMESTAMPDIFF(DAY,CAST(%2 AS ANSIDATE), %3)</formula>
<formula part='week'>ROUND(TIMESTAMPDIFF(DAY,CAST(%2 AS ANSIDATE), %3)/decimal(7, 7, 6), 0)</formula>
<formula part='hour'>TIMESTAMPDIFF(HOUR,%2, CAST(%3 AS TIMESTAMP))</formula>
<!-- This DATEDIFF 'week' formula finds the difference in weeks between the first days of the calendar
weeks in which each of the two given date parameters occur. It should work for any SOW value. -->
<formula part='week'>TIMESTAMPDIFF(WEEK,TIMESTAMPADD(DAY, -(DAYOFWEEK(%2,%4)-1), %2),TIMESTAMPADD(DAY, -(DAYOFWEEK(%3,%4)-1), %3))</formula>
<formula part='hour'>TIMESTAMPDIFF(HOUR,%2, CAST(%3 AS TIMESTAMP))</formula>
<formula part='minute'>TIMESTAMPDIFF(MINUTE,%2, CAST(%3 AS TIMESTAMP))</formula>
<formula part='second'>TIMESTAMPDIFF(SECOND,%2, CAST(%3 AS TIMESTAMP))</formula>
<argument type='localstr' />
Expand Down
4 changes: 3 additions & 1 deletion actian_odbc/dialect.tdd
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,9 @@
<formula part='dayofyear'>TIMESTAMPDIFF(DAY,CAST(%2 AS TIMESTAMP(2)), %3)</formula>
<formula part='day'>TIMESTAMPDIFF(DAY,CAST(%2 AS ANSIDATE), %3)</formula>
<formula part='weekday'>TIMESTAMPDIFF(DAY,CAST(%2 AS ANSIDATE), %3)</formula>
<formula part='week'>ROUND(TIMESTAMPDIFF(DAY,CAST(%2 AS ANSIDATE), %3)/decimal(7, 7, 6), 0)</formula>
<!-- This DATEDIFF 'week' formula finds the difference in weeks between the first days of the calendar
weeks in which each of the two given date parameters occur. It should work for any SOW value. -->
<formula part='week'>TIMESTAMPDIFF(WEEK,TIMESTAMPADD(DAY, -(DAYOFWEEK(%2,%4)-1), %2),TIMESTAMPADD(DAY, -(DAYOFWEEK(%3,%4)-1), %3))</formula>
<formula part='hour'>TIMESTAMPDIFF(HOUR,%2, CAST(%3 AS TIMESTAMP))</formula>
<formula part='minute'>TIMESTAMPDIFF(MINUTE,%2, CAST(%3 AS TIMESTAMP))</formula>
<formula part='second'>TIMESTAMPDIFF(SECOND,%2, CAST(%3 AS TIMESTAMP))</formula>
Expand Down

0 comments on commit 1220b1e

Please sign in to comment.