Search Postgresql Archives

Re: Get date timestamp(3) without time zone column - PGSQL 9.5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





2016-09-05 15:17 GMT+12:00 Patrick B <patrickbakerbr@xxxxxxxxx>:

You might want to share the version of PostgreSQL you are using. 

You might want to try date_trunc and AT TIMEZONE function/operators-


SELECT date_trunc('day', tasks_start at TIME ZONE 'EST')

Note: I have not tried this statement
 
Is this something you are going to use often? If that is the case then consider to re-model your query. The moment you use an _expression_ on a column it would not use a normal BTree index.


Hmm... I see....


select date_trunc('day', TIMESTAMP '2016-08-10') FROM tasks

 And I get: 

2016-08-10 00:00:00


I actually need just the date 2016-08-10, without 00:00:00...
Any idea?

Cheers
Patrick


I agree with @Tom, your first sql should work... Based on the table name "tasks" you provided, try this:


SELECT cast(jtasks_start as date) FROM "tasks" WHERE (date(tasks_start) in ('2016-08-11')) 


Lucas 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux