From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Patrick B <patrickbakerbr(at)gmail(dot)com> |
Cc: | Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Get date timestamp(3) without time zone column - PGSQL 9.5 |
Date: | 2016-09-05 03:34:39 |
Message-ID: | CAFj8pRBm0aiKpM1ZhvUeCkKUNjVTAEViaDwUrz=6iMnyDdTvUg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2016-09-05 5:17 GMT+02:00 Patrick B <patrickbakerbr(at)gmail(dot)com>:
>
>> You might want to share the version of PostgreSQL you are using.
>>
>> You might want to try date_trunc and AT TIMEZONE function/operators-
>>
>> https://www.postgresql.org/docs/9.4/static/functions-datetim
>> e.html#FUNCTIONS-DATETIME-TRUNC
>>
>> 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...
>
cast to date.
PostgreSQL timestamp shows time always.
Regards
Pavel
> Any idea?
>
> Cheers
> Patrick
>
From | Date | Subject | |
---|---|---|---|
Next Message | Lucas Possamai | 2016-09-05 03:37:19 | Re: Get date timestamp(3) without time zone column - PGSQL 9.5 |
Previous Message | Tom Lane | 2016-09-05 03:18:04 | Re: Get date timestamp(3) without time zone column - PGSQL 9.5 |