Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for QUARTER to EXTRACT, FIRST_DAY and LAST_DAY [CORE5693] #5959

Closed
firebird-automations opened this issue Jan 3, 2018 · 4 comments · Fixed by #7564
Closed

Add support for QUARTER to EXTRACT, FIRST_DAY and LAST_DAY [CORE5693] #5959

firebird-automations opened this issue Jan 3, 2018 · 4 comments · Fixed by #7564

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @ibprovider

I'm surprised that Firebird (v3) still not support QUARTER in EXTRACT statement.

It has a serious reason?

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

summary: EXTRACT(QUARTER FROM ) => Add support for QUARTER context to EXTRACT( xxx FROM Date|Timestamp)

@firebird-automations
Copy link
Collaborator Author

firebird-automations commented Jan 3, 2018

Commented by: @mrotteveel

The reason we don't have it, is probably that it is not defined in the standard (at least, not in SQL:2011). As a workaround, the quarter can be trivially derived using:

1 + (extract(MONTH from somevalue) - 1) / 3

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

What others DBMS has this?

@omachtandras
Copy link

Oracle: select to_char(sysdate, 'Q') as qtr from dual;
MSSQL: SELECT DATEPART(quarter, '2017/08/25') AS DatePartInt;
Mysql: SELECT QUARTER("2017-06-15");
Postre: SELECT EXTRACT (QUARTER FROM TIMESTAMP '2011-11-22 13:30:15')

Extract would also be logical for Firebird:
select extract(quarter from cast('TODAY' as date)) from rdb$database

@asfernandes asfernandes self-assigned this May 4, 2023
@asfernandes asfernandes changed the title Add support for QUARTER context to EXTRACT( xxx FROM Date|Timestamp) [CORE5693] Add support for QUARTER context to EXTRACT, FIRST_DAY and LAST_DAY [CORE5693] May 4, 2023
@asfernandes asfernandes changed the title Add support for QUARTER context to EXTRACT, FIRST_DAY and LAST_DAY [CORE5693] Add support for QUARTER to EXTRACT, FIRST_DAY and LAST_DAY [CORE5693] May 4, 2023
asfernandes added a commit that referenced this issue May 4, 2023
asfernandes added a commit that referenced this issue May 6, 2023
mrotteveel added a commit to mrotteveel/firebird-documentation that referenced this issue Jul 31, 2023
mrotteveel added a commit to mrotteveel/firebird-documentation that referenced this issue Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment