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

sqlutil: new operator to allow transparent datetime truncation across various DBMS #2032

Closed
pvanek opened this issue Aug 3, 2017 · 0 comments

Comments

@pvanek
Copy link
Contributor

pvanek commented Aug 3, 2017

Missing functionality like this (for Oracle):

alter session set nls_date_format = 'dd.mm.yyyy hh24:mi:ss';

select
      trunc(sysdate, 'MI')
    , trunc(sysdate, 'HH24')
    , trunc(sysdate, 'DD')
    , trunc(sysdate, 'MM')
    , trunc(sysdate, 'YYYY')
  from dual;

"TRUNC(SYSDATE,'MI')"	"TRUNC(SYSDATE,'HH24')"	"TRUNC(SYSDATE,'DD')"	"TRUNC(SYSDATE,'MM')"	"TRUNC(SYSDATE,'YYYY')"
03.08.2017 10:38:00	03.08.2017 10:00:00	03.08.2017 00:00:00	01.08.2017 00:00:00	01.01.2017 00:00:00

Analogies for:

mysql:

CAST(DATE_FORMAT(tstamp,'%Y-%m-%d %H:%i:00') AS DATETIME)

pgsql:

date_trunc('hour', current_timestamp)
@pvanek pvanek added this to the 0.8.11.x milestone Aug 3, 2017
@pvanek pvanek self-assigned this Aug 3, 2017
@pvanek pvanek removed this from the 0.8.11.x milestone Aug 3, 2017
pvanek added a commit that referenced this issue Aug 3, 2017
@pvanek pvanek added this to the 0.8.13 milestone Aug 3, 2017
pvanek added a commit that referenced this issue Aug 3, 2017
pvanek added a commit that referenced this issue Aug 3, 2017
pvanek added a commit that referenced this issue Aug 3, 2017
pvanek added a commit that referenced this issue Aug 3, 2017
@pvanek pvanek closed this as completed in 32e544f Aug 4, 2017
pvanek added a commit that referenced this issue Aug 4, 2017
…trunc

fixed #2032 sqlutil: new operator to allow transparent datetime trunc…
@omusil24 omusil24 added the fixed label Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants